diff --git a/Assets/Enemy/Gun.cs b/Assets/Enemy/Gun.cs index 3706fec..80f008b 100644 --- a/Assets/Enemy/Gun.cs +++ b/Assets/Enemy/Gun.cs @@ -3,9 +3,15 @@ using UnityEngine; public class Gun : MonoBehaviour { public float damageStrength; + void OnTriggerEnter2D (Collider2D hit) { - if (hit.tag == "Player") { - hit.GetComponent().health -= damageStrength; - } + // Damage player and destroy self on impact + if (hit.tag != "Player") return; + hit.GetComponent().health -= damageStrength; + Destroy(gameObject); + } + + void Update() { + transform.Rotate(new Vector3 (0, 0, Time.deltaTime * 1000)); } } diff --git a/Assets/Enemy/Gun.prefab b/Assets/Enemy/Gun.prefab index 26cdb17..aed11aa 100644 --- a/Assets/Enemy/Gun.prefab +++ b/Assets/Enemy/Gun.prefab @@ -30,7 +30,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} diff --git a/Assets/Enemy/GunThrower.prefab b/Assets/Enemy/GunThrower.prefab index e2565a2..f68267b 100644 --- a/Assets/Enemy/GunThrower.prefab +++ b/Assets/Enemy/GunThrower.prefab @@ -52,7 +52,7 @@ MonoBehaviour: damageTimeoutSeconds: 0.5 health: 10 gun: {fileID: 5213001249979318174, guid: 98b57b15498e96a9c8fe56264ac2ef63, type: 3} - throwSpeed: 41.61 + throwSpeed: 500 --- !u!212 &480941680556316754 SpriteRenderer: m_ObjectHideFlags: 0