summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Enemy3/Enemy3BulletScript.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Enemy3/Enemy3BulletScript.cs')
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3BulletScript.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Assets/Scripts/Enemy3/Enemy3BulletScript.cs b/Assets/Scripts/Enemy3/Enemy3BulletScript.cs
new file mode 100755
index 0000000..49ede52
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3BulletScript.cs
@@ -0,0 +1,32 @@
+using UnityEngine;
+using System.Collections;
+
+public class Enemy3BulletScript : MonoBehaviour {
+
+ bool fired;
+
+ void Start()
+ {
+ fired = false;
+ }
+
+
+ void Update()
+ {
+
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if (!fired)
+ {
+ var player = col.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ fired = true;
+ player.TakeDamage(20f);
+ Destroy(gameObject);
+ }
+ }
+ }
+}