aboutsummaryrefslogtreecommitdiff
path: root/td/Assets/Scripts/EnemySpawner.cs
diff options
context:
space:
mode:
Diffstat (limited to 'td/Assets/Scripts/EnemySpawner.cs')
-rw-r--r--td/Assets/Scripts/EnemySpawner.cs49
1 files changed, 0 insertions, 49 deletions
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<Vector3> _waypoints = new List<Vector3>();
- 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 <Transform> ();
- }
-
- 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 <Enemy> ();
- Transform transform = newEnemy.GetComponent <Transform>();
-
- script.Waypoints = _waypoints;
- script.Speed = Random.Range (0.3f, 1.2f);
- script.Player = Player;
- transform.position = new Vector3 (0.93f, 0.483f, 0f);
- }
-
- }
-}