Guns spin and die and self destruct on impact
This commit is contained in:
@@ -3,9 +3,15 @@ using UnityEngine;
|
||||
public class Gun : MonoBehaviour
|
||||
{
|
||||
public float damageStrength;
|
||||
|
||||
void OnTriggerEnter2D (Collider2D hit) {
|
||||
if (hit.tag == "Player") {
|
||||
hit.GetComponent<Teo>().health -= damageStrength;
|
||||
}
|
||||
// Damage player and destroy self on impact
|
||||
if (hit.tag != "Player") return;
|
||||
hit.GetComponent<Teo>().health -= damageStrength;
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
transform.Rotate(new Vector3 (0, 0, Time.deltaTime * 1000));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user