hello guys
well, i created a script in JS about the life of the enemy. what is this:
#pragma strict
var muerto : boolean = false;
var vidaE : float = 100;
function Update () {
if (vidaE >= 100) {
vidaE = 100;
}
if (vidaE <= 0) {
muerto = true;
}
if(muerto == true){
Destroy (this.gameObject, 2);
}
}
my doubt is the following:
how can do what the life of the enemy down with a animation of the player? because i know what the logic would put a function OnTriggerEnter (other : Collider) and his condition in the code. but happend what i want what when my Player use a animation of his animation´s tree, the life of enemy down. example: the animation of punch
i try with this, but i don´t know if it’s okay :
var : AnimationClip : Boolean = false;
the explication of that, is what when i press the key mouse0, the animation punch, what is a boolean, is activated. so, when she pass to true, in this code the script would know that and would do what the life down. but, don´t know how insert that here u.u
i wait his help guys, thank you and good night ![]()