/// <summary> /// Warrior lands. /// </summary> public void Land() { if (warrior == Warrior.Crossbow) { ikHands.BlendIK(true, 0.5f, 0.25f); } }
private void Awake() { // Get SuperCharacterController. superCharacterController = GetComponent <SuperCharacterController>(); // Get Movement Controller. warriorMovementController = GetComponent <WarriorMovementController>(); // Add Timing Controllers. warriorTiming = gameObject.AddComponent <WarriorTiming>(); warriorTiming.warriorController = this; // Add IKHands. ikHands = GetComponentInChildren <IKHands>(); if (ikHands != null) { if (warrior == Warrior.TwoHanded || warrior == Warrior.Hammer || warrior == Warrior.Crossbow || warrior == Warrior.Spearman) { ikHands.canBeUsed = true; ikHands.BlendIK(true, 0, 0.25f); } } // Setup Animator, add AnimationEvents script. animator = GetComponentInChildren <Animator>(); if (animator == null) { Debug.LogError("ERROR: There is no Animator component for character."); Debug.Break(); } else { animator.gameObject.AddComponent <WarriorCharacterAnimatorEvents>(); animator.GetComponent <WarriorCharacterAnimatorEvents>().warriorController = this; animator.gameObject.AddComponent <AnimatorParentMove>(); animator.GetComponent <AnimatorParentMove>().animator = animator; animator.GetComponent <AnimatorParentMove>().warriorController = this; animator.updateMode = AnimatorUpdateMode.AnimatePhysics; animator.cullingMode = AnimatorCullingMode.CullUpdateTransforms; } // Determine input source. warriorInputController = GetComponent <WarriorInputController>(); if (warriorInputController != null) { useInputSystem = false; } else { warriorInputSystemController = GetComponent <WarriorInputSystemController>(); if (warriorInputSystemController != null) { useInputSystem = true; } else { Debug.LogError("No inputs!"); } } // Setup Rigidbody. rb = GetComponent <Rigidbody>(); if (rb != null) { rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } currentState = WarriorState.Idle; }