diff --git a/Assets/Scripts/Abilities/MissileScript.cs b/Assets/Scripts/Abilities/MissileScript.cs index bd0cb2f76..ff202b983 100644 --- a/Assets/Scripts/Abilities/MissileScript.cs +++ b/Assets/Scripts/Abilities/MissileScript.cs @@ -81,13 +81,19 @@ public void SetTarget(Transform target) } // Update is called once per frame - void FixedUpdate () { + void FixedUpdate () + { if(target && (!target.GetComponent() || !target.GetComponent().invisible)) { var moveVector = (target.position - transform.position).normalized; GetComponent().AddForce(120 * moveVector); } - } + + if (target && target.GetComponent().GetIsDead() && Vector3.Distance(transform.position, target.position) < 0.1f) + { + Destroy(gameObject); + } + } public void SetTerrain(Entity.TerrainType terrain) {