I have been working on this script for the past month and my collisions are not working...
I have a drone and when a bullet hits the Sphere Collider, I want the drone to lose health and after it has been hit three times, I want the drone to add a rigidbody component and after 3 seconds, to disappear... Any suggestions?
Here's my code so far...
#pragma strict
function OnCollisionEnter(deadPlayer : Collision)
{
if (deadPlayer.gameObject.tag == "Drone")
{
Debug.Log("HIT");
Destroy(GameObject.FindGameObjectWithTag("Drone"));
}
}
↧