- Home /
Animation not working?
my animation is not working. i have checked every line and nothing is wrong. the animation is supposed to play whenever the player triggered the left mouse button. a little help out there?
#pragma strict
var thedamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
public var TheHammer : Transform;
function Update ()
{ if (Input.GetButtonDown("Fire1"));
{
TheHammer.animation["attack"].wrapMode = WrapMode.Once;
TheHammer.animation.Play("attack");
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage", thedamage, SendMessageOptions.DontRequireReceiver);
}
}
}
if (TheHammer.animation.isPlaying == false)
{
TheHammer.animation.CrossFade("HammerIdle");
}
}
Comment
Your answer