private DoneAnimatorSetup animSetup; // An instance of the AnimatorSetup helper class. void Awake () { // Setting up the references. player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; enemySight = GetComponent<DoneEnemySight>(); nav = GetComponent<NavMeshAgent>(); anim = GetComponent<Animator>(); hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>(); // Making sure the rotation is controlled by Mecanim. nav.updateRotation = false; // Creating an instance of the AnimatorSetup class and calling it's constructor. animSetup = new DoneAnimatorSetup(anim, hash); // Set the weights for the shooting and gun layers to 1. anim.SetLayerWeight(1, 1f); anim.SetLayerWeight(2, 1f); // We need to convert the angle for the deadzone from degrees to radians. deadZone *= Mathf.Deg2Rad; }
private DoneAnimatorSetup animSetup; // An instance of the AnimatorSetup helper class. void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; enemySight = GetComponent <DoneEnemySight>(); nav = GetComponent <NavMeshAgent>(); anim = GetComponent <Animator>(); hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneHashIDs>(); // Making sure the rotation is controlled by Mecanim. nav.updateRotation = false; // Creating an instance of the AnimatorSetup class and calling it's constructor. animSetup = new DoneAnimatorSetup(anim, hash); // Set the weights for the shooting and gun layers to 1. anim.SetLayerWeight(1, 1f); anim.SetLayerWeight(2, 1f); // We need to convert the angle for the deadzone from degrees to radians. deadZone *= Mathf.Deg2Rad; }