using UnityEngine;
using System.Collections;
public class WeaponAnimControl : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Animator anim = GetComponent<Animator> ();
if(Input.GetMouseButton(1)){
anim.SetBool("RightClick", true);
Debug.Log ("Aiming Down Sights");
}
if(Input.GetButton ("forward")){
anim.SetBool ("walking", true);
Debug.Log ("Forward");
}
if (Input.GetButton ("left")) {
anim.SetBool ("walking", true);
Debug.Log ("Left");
}
if (Input.GetButton ("back")) {
anim.SetBool ("walking", true);
Debug.Log ("Backwards");
}
if (Input.GetKey ("right")){
anim.SetBool("walking", true);
Debug.Log ("Right");
}
if (Input.GetKeyUp ("Fire2")){
anim.SetBool ("RightClick", false);
}
else{
anim.SetBool("RightClick", false);
anim.SetBool ("walking", false);
Debug.Log ("Idle-ing");
}
}
}
I can’t get the character to leave the ADS (Aim Down Sights) mode.
Even when I let go of the Right Mouse Button, the animation for ADS loops.
I want it to leave ADS and just jump straight into the walking animation again. (Yes, I will put an animation that transitions them, but for now this is what I need.)