diff options
author | Mikkel Bybjerg <mikkel.bybjerg@hotmail.com> | 2019-04-27 14:08:56 +0200 |
---|---|---|
committer | Mikkel Bybjerg <mikkel.bybjerg@hotmail.com> | 2019-04-27 14:08:56 +0200 |
commit | 157b333e762ab61b6aa9eea1f10469081c143c03 (patch) | |
tree | 63f2be7afb99f9fb5b0774da04a12a99abbcdefb /nGJ2019/Assets/Scripts/ObstacleSpawner.cs | |
parent | bdb5c4825e6114a130498ed6629826a05378409a (diff) | |
parent | 1a90d920504e77af4fb16e108fe12e505386d2d5 (diff) |
merge
Diffstat (limited to 'nGJ2019/Assets/Scripts/ObstacleSpawner.cs')
-rw-r--r-- | nGJ2019/Assets/Scripts/ObstacleSpawner.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs index 7d2c2a9..102df97 100644 --- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs +++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs @@ -8,6 +8,7 @@ public class ObstacleSpawner : MonoBehaviour public GameObject alfaPrefab; public GameObject betaPrefab; + public LevelScrolling scrolling; public float spawnLine; @@ -21,15 +22,16 @@ public class ObstacleSpawner : MonoBehaviour if(e.type == ObstacleType.beta) prefab = betaPrefab; - Instantiate(prefab, new Vector3(spawnLine, e.height, 0), Quaternion.identity); + var transformT = ((GameObject) Instantiate(prefab, new Vector3(spawnLine, e.height, 0), Quaternion.identity)).transform; + scrolling.Obstacles.Add(transformT); } void Start() { - timeline.Add(2, 4, ObstacleType.alfa); - timeline.Add(4, 2, ObstacleType.beta); - timeline.Add(5, -2, ObstacleType.beta); - timeline.Add(7, -3, ObstacleType.alfa); + for(int i = 0; i < 120; i += 5) + { + timeline.Add(i, 0, ObstacleType.alfa); + } timeline.OnSpawnEvent += spawnOnEvent; } |