diff options
Diffstat (limited to 'td/Assets/Scripts/Enemy.cs')
-rw-r--r-- | td/Assets/Scripts/Enemy.cs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/td/Assets/Scripts/Enemy.cs b/td/Assets/Scripts/Enemy.cs index 7273370..edd9e29 100644 --- a/td/Assets/Scripts/Enemy.cs +++ b/td/Assets/Scripts/Enemy.cs @@ -6,18 +6,11 @@ public class Enemy : MonoBehaviour { public float speed; public float initialHp; - public Transform pathWay; + public List<Vector3> waypoints; - List<Vector3> waypoints = new List<Vector3>(); Vector3 waypointPos; int waypointNum = -1; // Using minus one so that first addition returns 0, first element in array - void Start () { - foreach (Transform child in pathWay) { - waypoints.Add (child.position); - } - } - void Update () { updateWaypoint (); @@ -32,7 +25,7 @@ public class Enemy : MonoBehaviour { void updateWaypoint() { if ( (transform.position == waypointPos && waypointNum < waypoints.Count - 1) || waypointNum == -1) { waypointNum++; - waypointPos = new Vector3 (waypoints [waypointNum].x, 0.604f, waypoints [waypointNum].z); + waypointPos = new Vector3 (waypoints [waypointNum].x, 0.483f, waypoints [waypointNum].z); } } |