I have wrote this script which kind of does what I want it too; I want it to play an idle animation if nothing is being pressed play a walk animation when w or s is pressed, play a shoot animation when the LMB is clicked and play a reload animation when r is pressed. All this works but the shoot animation sort of delays which I dont want. Can anyone help me out with this?
this is my script,
function Start () {
animation.wrapMode = WrapMode.Loop;
animation[“idle”].speed = 0.2;
animation[“walk”].speed = 1;
animation[“reload”].speed = 1;
animation[“shoot”].speed = 2;
animation[“shoot”].wrapMode = WrapMode.Once;
animation[“reload”].wrapMode = WrapMode.Once;
animation[“shoot”].layer = 1;
animation[“reload”].layer = 2;
animation.Stop();
}
function Update () {
if (Mathf.Abs(Input.GetAxis(“Vertical”)) > 0.1)
animation.CrossFade("walk");
else
animation.CrossFade("idle");
if(Input.GetButtonDown(“Fire1”))
animation.CrossFade("shoot");
if (Input.GetButtonDown(“r”))
animation.CrossFade("reload");
}