Merge branch 'JumpCorrection' of https://github.com/ElPoyo266/AwesomeRunner- into dev

This commit is contained in:
Louis 2025-01-07 16:19:52 +01:00
commit 4181b857e1
3 changed files with 3751 additions and 13 deletions

View File

@ -404,7 +404,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<CurveStrengthY>k__BackingField: 0 <CurveStrengthY>k__BackingField: 0
<CurveStrengthX>k__BackingField: 0 <CurveStrengthX>k__BackingField: 0
curveOrigin: {fileID: 0} curveOrigin: {fileID: 963194228}
--- !u!4 &533191358 --- !u!4 &533191358
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -528,7 +528,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1

View File

@ -8,9 +8,14 @@ public class ChunkGenerator : MonoBehaviour
[SerializeField] private LaneSystem LaneSystem; [SerializeField] private LaneSystem LaneSystem;
public CoinPool CoinPool { get; private set; } public CoinPool CoinPool { get; private set; }
[field: SerializeField] public List<ObstaclePool> ObstaclePools { get; private set; } [field: SerializeField] public List<ObstaclePool> ObstaclePools { get; private set; }
private bool isFirstChunk = true;
public Chunk Generate(Chunk chunkToFill) public Chunk Generate(Chunk chunkToFill)
{ {
if (isFirstChunk)
{
isFirstChunk = false;
return chunkToFill;
}
if (ObstaclePools.IsEmpty()) if (ObstaclePools.IsEmpty())
return chunkToFill; return chunkToFill;
var obstaclePool = ObstaclePools.GetRandomElement(); var obstaclePool = ObstaclePools.GetRandomElement();
@ -20,7 +25,11 @@ public class ChunkGenerator : MonoBehaviour
obstacle.transform.localPosition = chunkToFill.Grid.GetRandomPosition(); obstacle.transform.localPosition = chunkToFill.Grid.GetRandomPosition();
if (obstacle.IsOnAllLanes) if (obstacle.IsOnAllLanes)
{ {
obstacle.transform.localPosition = new Vector3(LaneSystem.CenterLane * LaneSystem.LaneWidth, transform.localPosition.y, transform.localPosition.z); obstacle.transform.localPosition = new Vector3(
LaneSystem.CenterLane * LaneSystem.LaneWidth,
transform.localPosition.y,
transform.localPosition.z
);
} }
return chunkToFill; return chunkToFill;
} }

File diff suppressed because one or more lines are too long