- Home /
How to conect distance with animation?
Ok my problem starts with the animation. So I am making a shooting game but the problem is that I have an animation of the enemy that hits but I am trying to remove the players life but the if of the animation(obviously) it dosent work so I need the correct form to put that script. Here is a little of the code(is in javascript):
if(Vector3.Distance(transform.position, target.position)<5){
if(animation.Play == "hits"){
var damage = 25;
target.SendMessage("ApplyDamage",damage,SendMessageOptions.DontRequireReceiver);
}
}
Also I important, I need to make an if of the angle that the enemy needs to be to count the damage done when he hits you. Also if another person has a better idea I will really appreciate it. Thaks.... In advance :P
Comment