Esempio n. 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>();
            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;
        }
Esempio n. 2
0
 private void Awake()
 {
     //Setup Animator, add AnimationEvents script.
     animator = GetComponentInChildren <Animator>();
     if (animator == null)
     {
         Debug.LogError("ERROR: There is no Animator component for character.");
         Destroy(this);
     }
     else
     {
         animator.gameObject.AddComponent <RPGCharacterAnimatorEvents>();
         animator.GetComponent <RPGCharacterAnimatorEvents>().rpgCharacterController = this;
     }
     rpgCharacterMovementController = GetComponent <RPGCharacterMovementController>();
     rpgCharacterWeaponController   = GetComponent <RPGCharacterWeaponController>();
     rpgCharacterInputController    = GetComponent <RPGCharacterInputController>();
     //Find HeadLookController if applied.
     headLookController = GetComponent <PerfectLookAt>();
     ikHands            = GetComponent <IKHands>();
     //Set for starting Unarmed state.
     weapon = Weapon.UNARMED;
     animator.SetInteger("Weapon", 0);
     animator.SetInteger("WeaponSwitch", -1);
     StartCoroutine(_ResetIdleTimer());
     //Turn off headlook in editor.
                 #if UNITY_EDITOR
     headLook = false;
                 #endif
     isHeadlook = headLook;
 }
 private void OnTriggerExit(Collider collide)
 {
     if (collide.gameObject == character)
     {
         RPGCharacterMovementController movement = character.GetComponent <RPGCharacterMovementController>();
         movement.jumpSpeed = oldJumpSpeed;
         character          = null;
     }
 }
        void Awake()
        {
            // In order for the navMeshAgent not to interfere with other movement, we want it to be
            // enabled ONLY when we are actually using it.
            navMeshAgent         = GetComponent <UnityEngine.AI.NavMeshAgent>();
            navMeshAgent.enabled = false;

            rpgCharacterController         = GetComponent <RPGCharacterController>();
            rpgCharacterMovementController = GetComponent <RPGCharacterMovementController>();
            rpgCharacterController.SetHandler("Navigation", new Actions.Navigation(this));
        }
        private void OnTriggerEnter(Collider collide)
        {
            RPGCharacterController controller = collide.gameObject.GetComponent <RPGCharacterController>();

            if (controller != null)
            {
                character = collide.gameObject;

                RPGCharacterMovementController movement = character.GetComponent <RPGCharacterMovementController>();
                oldJumpSpeed       = movement.jumpSpeed;
                movement.jumpSpeed = oldJumpSpeed * 2f;
                Debug.Log("Trampoline!");
            }
        }
Esempio n. 6
0
 void Awake()
 {
     rpgCharacterMovementController = GetComponent <RPGCharacterMovementController>();
     rpgCharacterInputController    = GetComponent <RPGCharacterInputController>();
     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 for character.");
         Destroy(this);
     }
 }
Esempio n. 7
0
 private void Awake()
 {
     rpgCharacterController         = GetComponent <RPGCharacterController>();
     rpgCharacterMovementController = GetComponent <RPGCharacterMovementController>();
     rpgCharacterWeaponController   = GetComponent <RPGCharacterWeaponController>();
 }
Esempio n. 8
0
 void Awake()
 {
     rpgCharacterController         = GetComponent <RPGCharacterControllerFREE>();
     rpgCharacterMovementController = GetComponent <RPGCharacterMovementController>();
 }