コード例 #1
0
        private void Awake()
        {
            rpgCharacterMovementController = GetComponent <RPGCharacterMovementController>();
            rpgCharacterWeaponController   = GetComponent <RPGCharacterWeaponController>();
            rpgCharacterInputController    = GetComponent <RPGCharacterInputController>();
            animator = GetComponentInChildren <Animator>();
            if (animator == null)
            {
                Debug.LogError("ERROR: There is no animator for character.");
                Destroy(this);
            }
            //Find HeadLookController if applied.
            headLookController = GetComponent <PerfectLookAt.PerfectLookAt>();
            ikHands            = GetComponent <IKHands>();
            //Set for starting Relax state.
            weapon = Weapon.RELAX;
            animator.SetInteger("Weapon", -1);
            animator.SetInteger("WeaponSwitch", -1);
            StartCoroutine(_ResetIdleTimer());
            //Turn off headlook in editor.
#if UNITY_EDITOR
            headLook = false;
#endif
            isHeadlook = headLook;
        }
コード例 #2
0
 private void Awake()
 {
     superCharacterController    = GetComponent <SuperCharacterController.Code.SuperCharacterController.Core.SuperCharacterController>();
     rpgCharacterController      = GetComponent <RPGCharacterController>();
     rpgCharacterInputController = GetComponent <RPGCharacterInputController>();
     navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>();
     animator     = GetComponentInChildren <Animator>();
     capCollider  = GetComponent <CapsuleCollider>();
     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      = RPGCharacterState.Idle;
     rpgCharacterState = RPGCharacterState.Idle;
 }