diff options
Diffstat (limited to 'nGJ2019/Assets/Scripts/DragonMovement.cs')
-rw-r--r-- | nGJ2019/Assets/Scripts/DragonMovement.cs | 12 |
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 |