im making yet another slenderman indie, and i am trying to make it so that when slenderman comes in contact with the first person controller it kills him and resets the location, esentially restarting the game. i have my stalking script down but my damage system seems to be ineffective. i have looked at it several times. it is such a simple script yet it remains ineffective. my first person controller contains the rigidbody component while my enemy contains a mesh collider.
1. var health : int = 100;
private var dead : boolean = false;
var enemyDamage : int = -100;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "BloodBoss")
{
health +=enemyDamage;
}
}
function Update () {
if(health <= 0)
{
dead = true;
}
if(dead == true)
{
transform.position = Vector3(0,0,0);
}
}
↧