From 5440734d820606b29a795c46172ade5d7eba8efb Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Mon, 3 Sep 2018 23:34:21 +0100 Subject: Initial commit --- Assets/Scripts/Enemy.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Assets/Scripts/Enemy.cs (limited to 'Assets/Scripts/Enemy.cs') diff --git a/Assets/Scripts/Enemy.cs b/Assets/Scripts/Enemy.cs new file mode 100644 index 0000000..a7af21f --- /dev/null +++ b/Assets/Scripts/Enemy.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Enemy : MonoBehaviour { + private Vector2 start; + + void OnTriggerStay2D(Collider2D other) { + GameObject ogo = other.gameObject; + switch (ogo.tag) { + case "Player": + CharacterControl script = ogo.GetComponent(); + script.Damaged(); + break; + } + } + + void Start() { + start = this.transform.position; + } + + public void Reset() { + Debug.Log(this); + this.transform.position = start; + GetComponent().enabled = true; + GetComponent().enabled = true; + } +} -- cgit v1.2.1