var projectile : Rigidbody;
var speed = 10;
var TheDammage = 50;
function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
clone = Instantiate(projectile, transform. position, transform.rotation);// bullet shoots
clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));// bullet speed
Destroy (clone.gameObject, 5);// bullet is destroyed
Rigidbody.SendMessage("ApplyDammage", TheDammage, projectile );// I need to find a way to replace Rigidbody
}
}
↧