aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Bybjerg <mikkel.bybjerg@hotmail.com>2019-04-27 11:14:45 +0200
committerMikkel Bybjerg <mikkel.bybjerg@hotmail.com>2019-04-27 11:14:45 +0200
commit12f21516ffd7caacfec259d6771677769384ffe8 (patch)
tree31ddc0544f39934e3780b96d145c7525cf3d6704 /nGJ2019/Assets/Scripts/DragonMovement.cs
parent0ef7e7d16e955401131fb2110c3b3dda66ccc0e3 (diff)
enemy collision and health
Diffstat (limited to 'nGJ2019/Assets/Scripts/DragonMovement.cs')
-rw-r--r--nGJ2019/Assets/Scripts/DragonMovement.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/nGJ2019/Assets/Scripts/DragonMovement.cs b/nGJ2019/Assets/Scripts/DragonMovement.cs
index 04f1c3a..4ba179d 100644
--- a/nGJ2019/Assets/Scripts/DragonMovement.cs
+++ b/nGJ2019/Assets/Scripts/DragonMovement.cs
@@ -12,6 +12,8 @@ public class DragonMovement : MonoBehaviour
public float horizontalBound = 6f;
public float verticalBound = 4f;
+ public HealthBar healthBar;
+
private SwarmSystem swarm;
private enum State {normal, swirl, slim, spread};
@@ -198,4 +200,14 @@ public class DragonMovement : MonoBehaviour
Gizmos.DrawWireCube(Vector3.zero, new Vector3(2*horizontalBound, 2*verticalBound, 0));
}
+ void OnTriggerEnter(Collider other)
+ {
+ EnemyCollider enemy = other.gameObject.GetComponent<EnemyCollider>();
+ if(enemy != null)
+ {
+ Debug.Log(enemy.type == ObstacleType.alfa ? "alfa hit" : "beta hit");
+ healthBar.health--;
+ }
+ }
+
} \ No newline at end of file