/// <summary> /// return to guard position state /// </summary> private void _return_state() { m_CurrentDest = m_StartPosition; m_Direction2target = m_CurrentDest - transform.position; m_Distance2target = m_Direction2target.magnitude; m_Direction2target.y = 0.0f; m_Direction2target.Normalize(); _calc_ranges(); m_Character.setMoveMode(TPCharacter.MovingMode.RotateToDirection); _calculate_path(ref m_Move); m_Move.y = 0.0f; m_Move *= m_Stats.DefaultMoveSpeed; m_BodyLookDir = m_Move; if (takingHit) { m_Move = Vector3.zero; m_BodyLookDir = Vector3.zero; } m_Character.move(m_Move, false, false, false, m_BodyLookDir, Vector3.zero); if (m_InAttackRange) { m_NpcState = NPCState.Idle; m_Character.setMoveMode(TPCharacter.MovingMode.RotateToDirection); m_Move = Vector3.zero; m_Character.fullStop(); m_OnStartPosition = true; } }
/// <summary> /// end trigger animations /// </summary> /// <param name="character">character interacting with trigger</param> /// <param name="limbsIK">ik helper</param> public override void end(TPCharacter character, IKHelper limbsIK) { if (!character) { #if DEBUG_INFO Debug.LogError("object cannot be null!" + " < " + this.ToString() + ">"); #endif return; } if (!Target) { #if DEBUG_INFO Debug.LogWarning("trigger target not assigned!" + " < " + this.ToString() + ">"); #endif return; } character.triggerRootMotion = false; character.disableMove = false; character.setMoveMode(TPCharacter.MovingMode.Ledge); OrbitCameraController oc = character.GetComponentInChildren <OrbitCameraController>(); if (oc) { oc.additiveRotation = true; } character.disableCapsuleScale = true; character.animator.SetBool(/*"pGrabLedgeUp"*/ HashIDs.GrabLedgeUpBool, false); character.animator.SetBool(/*"pOnLedge"*/ HashIDs.OnLedgeBool, true); character.animatorDampTime = 0.0f; character.ledgeMove = true; character.disableLedgeConstraint = false; character.fullStop(); character.jumpAllowed = true; if (limbsIK) { limbsIK.RHandIKEnabled = true; limbsIK.LFootIKEnabled = true; limbsIK.RFootIKEnabled = true; limbsIK.LHandIKEnabled = true; limbsIK.LFWeightTime = 0.0f; limbsIK.RFWeightTime = 0.0f; limbsIK.startLedgeAdjust(m_TriggerInfo.targetRotation); limbsIK.checkHang = true; } if (character.animator.GetBool(/*"pLedgeHang"*/ HashIDs.LedgeHangBool)) { character.restoreCapsuleSize(); } else { character.scaleCapsuleToHalf(); } }