diff options
Diffstat (limited to 'td/Assets/Scripts/Enemy.cs')
-rw-r--r-- | td/Assets/Scripts/Enemy.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/td/Assets/Scripts/Enemy.cs b/td/Assets/Scripts/Enemy.cs index eec02c9..4542902 100644 --- a/td/Assets/Scripts/Enemy.cs +++ b/td/Assets/Scripts/Enemy.cs @@ -6,9 +6,13 @@ public class Enemy : MonoBehaviour { /* This is a general class that contains an enemy, * Currently it follows the pathway, and dies when reacing the end */ + [Header("Attributes")] public float speed; // Speed multiplier - public float initialHp; // HealthPoints + public int initialHp; // HealthPoints + public int damage; public List<Vector3> waypoints; // Pathway waypoints, should be set by the spawner + [Header("Scripting vars")] + public player player; // Reference to the player object, should be set when instantiating Vector3 waypointPos; // Current waypoint position int waypointNum = -1; // Using minus one so that first addition returns 0, first element in array @@ -24,7 +28,9 @@ public class Enemy : MonoBehaviour { // Selfdestruct if object reached the end if (waypointNum + 1 >= waypoints.Count) { + player.decreaseHealth (damage); Destroy (gameObject); + return; } } |