From fae01da58dbea66af402807d7409fa53602f71fa Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Sat, 14 Oct 2017 22:07:19 +0200 Subject: Finished wavesystem. Should improve graph for how many enemies should spawn each time --- td/Assets/Scripts/EnemySpawner.cs | 49 --------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 td/Assets/Scripts/EnemySpawner.cs (limited to 'td/Assets/Scripts/EnemySpawner.cs') diff --git a/td/Assets/Scripts/EnemySpawner.cs b/td/Assets/Scripts/EnemySpawner.cs deleted file mode 100644 index a1a6b1f..0000000 --- a/td/Assets/Scripts/EnemySpawner.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class EnemySpawner : MonoBehaviour { - /* This is a class that spawns an enemy with a random interval - * it is not very good, but is what it needs to be for testing purposes */ - // TODO Add wave system with increasing difficulty - public Enemy EnemyPrefab; - public Transform PathWay; - [Header("Scripting vars")] - public Player Player; // Reference to the player object, should be set in designer - - private Transform _parentObject; - - private List _waypoints = new List(); - private int _next = 1; - private int _n = 0; - - void Awake() { - foreach (Transform child in PathWay) { - _waypoints.Add (child.position); - } - } - - void Start() { - _parentObject = transform.Find ("enemies").gameObject.GetComponent (); - } - - void Update () { - if (Player.GameIsPaused()) { return; } // This ensures that the game stays paused - _n++; - - if (_n == _next) { - _n = 0; - _next = (int)Random.Range (50, 400); - - Enemy newEnemy = Instantiate (EnemyPrefab, new Vector3(0, 0, 0), Quaternion.identity, _parentObject); - Enemy script = newEnemy.GetComponent (); - Transform transform = newEnemy.GetComponent (); - - script.Waypoints = _waypoints; - script.Speed = Random.Range (0.3f, 1.2f); - script.Player = Player; - transform.position = new Vector3 (0.93f, 0.483f, 0f); - } - - } -} -- cgit v1.2.3