/// <summary> /// Simply swaps between what movement logic you want to use. /// <see cref="Utility.eMovementType.BOBBING"/>, /// <para>Represents Bobbing Logic.</para> /// <see cref="Utility.eMovementType.PULLEY"/>, /// <para>Represents Pulley Logic.</para> /// <see cref="Utility.eMovementType.ARM_SWING"/> /// <para>Represents Arm Swing Logic.</para> /// <param name="a_newType">What movement type do you want to switch to?</param> /// </summary> public void SwapMovement(Utility.eMovementType a_newType) { Utility.eMovementType prevType = m_movementType; m_movementType = a_newType; disableInactiveMovement(prevType, a_newType); Debug.Log("Swapping to" + a_newType); }
/// <summary> /// Looks at your previous movement type and new movement type, and disables and enables the correct component. /// </summary> /// <param name="a_previousMove">The previous movement type</param> /// <param name="a_newMove">The movement type you are changing to</param> private void disableInactiveMovement(Utility.eMovementType a_previousMove, Utility.eMovementType a_newMove) { switch (a_previousMove) { case Utility.eMovementType.ARM_SWING: m_asMovement.enabled = false; break; case Utility.eMovementType.BOBBING: m_hbMovement.enabled = false; break; case Utility.eMovementType.PULLEY: m_pMovement.enabled = false; m_pMovement.ResetValues(); break; //DEVELOPER: you know what to do! } switch (a_newMove) { case Utility.eMovementType.ARM_SWING: m_asMovement.enabled = true; break; case Utility.eMovementType.BOBBING: m_hbMovement.enabled = true; break; case Utility.eMovementType.PULLEY: m_pMovement.enabled = true; break; //DEVELOPER: you know what to do! } }
/// <summary> /// Auto detects your initial movement setup based on the settings used to setup your custom loco VR rig. /// </summary> private void AutoDetectCurrentMovement() { if (m_hbMovement.enabled) { m_movementType = Utility.eMovementType.BOBBING; Debug.Log("Bob movement detected... SETTING IT UP FOR YOU!"); } else if (m_asMovement.enabled) { m_movementType = Utility.eMovementType.ARM_SWING; Debug.Log("Arm Swing movement detected... SETTING IT UP FOR YOU!"); } else if (m_pMovement.enabled) { m_movementType = Utility.eMovementType.PULLEY; Debug.Log("Pulley movement detected... SETTING IT UP FOR YOU!"); //DEVELOPER: add an elseif for this logic to allow for autodetect on your movement } else { Debug.LogError("Your VR rig has not been setup properly! no movement types are enabled!"); } }