void Awake() { superCharacterController = GetComponent <SuperCharacterController>(); rpgCharacterController = GetComponent <RPGCharacterControllerFREE>(); rpgCharacterInputController = GetComponent <RPGCharacterInputControllerFREE>(); navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>(); animator = GetComponentInChildren <Animator>(); rb = GetComponent <Rigidbody>(); if (rb != null) { //Set restraints on startup if using Rigidbody. rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } //Set currentState to idle on startup. currentState = RPGCharacterStateFREE.Idle; rpgCharacterState = RPGCharacterStateFREE.Idle; }
void Awake() { rpgCharacterMovementController = GetComponent <RPGCharacterMovementControllerFREE>(); rpgCharacterWeaponController = GetComponent <RPGCharacterWeaponControllerFREE>(); rpgCharacterInputController = GetComponent <RPGCharacterInputControllerFREE>(); animator = GetComponentInChildren <Animator>(); if (animator == null) { Debug.LogError("ERROR: There is no animator for character."); Destroy(this); } if (target == null) { Debug.LogError("ERROR: There is no target set for character."); Destroy(this); } ikHands = GetComponent <IKHandsFREE>(); //Set for starting Unarmed state. weapon = Weapon.UNARMED; animator.SetInteger("Weapon", 0); animator.SetInteger("WeaponSwitch", -1); }