private void Awake() { m_trajectoryGenerator = GetComponentInChildren<MxMTrajectoryGenerator>(); m_animDecoupler = GetComponent<MxMAnimationDecoupler>(); m_charController = GetComponent<GenericControllerWrapper>(); if(m_trajectoryGenerator == null) { Debug.LogError("ExampleDecoupleMovementControl cannot find a trajectory generator component. Disabling component"); enabled = false; return; } if(m_animDecoupler == null) { Debug.LogError("ExampleDecoupleMovementControl cannot find a MxMAnimationDecoupler component. Disabling component"); enabled = false; return; } if(m_charController == null) { Debug.LogError("ExampleDecoupleMovementControl canno find a GenericControllerWrapper component. Disabling component"); enabled = false; return; } }
private void Start() { m_mxmAnimator = m_playerTransform.GetComponentInChildren <MxMAnimator>(); m_trajectoryGenerator = m_playerTransform.GetComponentInChildren <MxMTrajectoryGenerator>(); m_runTagHandle = m_mxmAnimator.CurrentAnimData.FavourTagFromName(m_runSpeedTagName); m_sprintTagHandle = m_mxmAnimator.CurrentAnimData.FavourTagFromName(m_sprintSpeedTagName); m_mxmAnimator.SetFavourMultiplier(m_favourMultiplier); }
// Start is called before the first frame update void Start() { m_mxmAnimator = GetComponent <MxMAnimator>(); m_controller = GetComponent <CharacterController>(); m_trajectoryGenerator = GetComponent <MxMTrajectoryGenerator>(); m_rootMotionAplicator = GetComponent <MxMRootMotionApplicator>(); m_vaultDetector = GetComponent <VaultDetector>(); m_locomotionSpeedRamp = GetComponent <LocomotionSpeedRamp>(); m_defaultControllerHeight = m_controller.height; m_defaultControllerCenter = m_controller.center.y; m_controller.enableOverlapRecovery = true; m_trajectoryGenerator.InputProfile = m_generalLocomotion; }
public void Awake() { if (m_vaultConfigurations == null || m_vaultConfigurations.Length == 0) { Debug.LogError("VaultDetector: Trying to Awake Vault Detector with null or empty vault configurations (m_vaultConfiguration)"); Destroy(this); return; } if (m_vaultDefinitions == null || m_vaultDefinitions.Length == 0) { Debug.LogError("VaultDetector: Trying to Awake Vault Detector with null or empty vault definitions (m_vaultDefinitions)"); Destroy(this); return; } m_mxmAnimator = GetComponentInChildren <MxMAnimator>(); if (m_mxmAnimator == null) { Debug.LogError("VaultDetector: Trying to Awake Vault Detector but the MxMAnimator component cannot be found"); Destroy(this); return; } m_trajectoryGenerator = GetComponentInChildren <MxMTrajectoryGenerator>(); if (m_trajectoryGenerator == null) { Debug.LogError("VaultDetector: Trying to Awake Vault Detector but there is no Trajectory component found that implements IMxMTrajectory."); Destroy(this); return; } m_rootMotionApplicator = GetComponentInChildren <MxMRootMotionApplicator>(); m_controllerWrapper = GetComponentInChildren <GenericControllerWrapper>(); m_minVaultRise = float.MaxValue; m_maxVaultRise = float.MinValue; m_minVaultDepth = float.MaxValue; m_maxVaultDepth = float.MinValue; m_minVaultDrop = float.MaxValue; m_maxVaultDrop = float.MinValue; foreach (VaultDefinition vd in m_vaultDefinitions) { switch (vd.VaultType) { case EVaultType.StepUp: { if (vd.MinRise < m_minVaultRise) { m_minVaultRise = vd.MinRise; } if (vd.MaxRise > m_maxVaultRise) { m_maxVaultRise = vd.MaxRise; } if (vd.MinDepth < m_minVaultDepth) { m_minVaultDepth = vd.MinDepth; } } break; case EVaultType.StepOver: { if (vd.MinRise < m_minVaultRise) { m_minVaultRise = vd.MinRise; } if (vd.MaxRise > m_maxVaultRise) { m_maxVaultRise = vd.MaxRise; } if (vd.MinDepth < m_minVaultDepth) { m_minVaultDepth = vd.MinDepth; } if (vd.MaxDepth > m_maxVaultDepth) { m_maxVaultDepth = vd.MaxDepth; } } break; case EVaultType.StepOff: { if (vd.MinDepth < m_minVaultDepth) { m_minVaultDepth = vd.MinDepth; } if (vd.MinDrop < m_minVaultDrop) { m_minVaultDrop = vd.MinDrop; } if (vd.MaxDrop > m_maxVaultDrop) { m_maxVaultDrop = vd.MaxDrop; } } break; } } m_curConfig = m_vaultConfigurations[0]; DesiredAdvance = Advance = 0f; m_vaultAnalysisIterations = (int)(m_maxVaultDepth / m_curConfig.ShapeAnalysisSpacing) + 1; }