Create Gun thrower subclass of ratbot that spawns gun objects
This commit is contained in:
11
Assets/Enemy/Gun.cs
Normal file
11
Assets/Enemy/Gun.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Gun : MonoBehaviour
|
||||
{
|
||||
public float damageStrength;
|
||||
void OnTriggerEnter2D (Collider2D hit) {
|
||||
if (hit.tag == "Player") {
|
||||
hit.GetComponent<Teo>().health -= damageStrength;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user