public void OnChangeGameMode(EGameModes eGameModeNew, EGameModes eGameModeOld) { //###DEV //foreach (CSoftBody oSoftBody in _aSoftBodies) // oSoftBody.OnChangeGameMode(eGameModeNew, eGameModeOld); foreach (CActor oActor in _aActors) oActor.OnChangeGameMode(eGameModeNew, eGameModeOld); }
public void OnChangeGameMode(EGameModes eGameModeNew, EGameModes eGameModeOld) { // Joint becomes kinematic and reverts to starting position upon configure mode, becomes PhysX-simulated during gameplay switch (eGameModeNew) { case EGameModes.Configure: _X = _Y = _Z = 0; UpdateRotation(); _oRigidBody.isKinematic = true; transform.localPosition = _vecStartingPos; // Restore the joint to its startup position / orientation transform.localRotation = _quatStartingRotation; break; case EGameModes.Play: if (_oConfJoint != null) { JointDrive oDrive = _oConfJoint.slerpDrive; oDrive.positionSpring = _nDriveStrengthMult * CGame.INSTANCE.BoneDriveStrength; // Final spring strength is the global constant multiplied by the provided multiplier... makes it easy to adjust whole-body drive strength _oConfJoint.slerpDrive = oDrive; } _oRigidBody.isKinematic = false; _X = _Y = _Z = 0; UpdateRotation(); break; //###IMPROVE: Add a new game mode for kinematic but 'reset pose to T'? } }
//--------------------------------------------------------------------------- GAME MODES public void ChangeGameMode(EGameModes eGameMode) { //###NOW#11: Huge shift in meaning! Remove the old crap! if (_GameMode == eGameMode) return; _GameMode = eGameMode; switch (_GameMode) { case EGameModes.Play: foreach (CBodyBase oBodyBase in _aBodyBases) // Entering play mode. Tell all body bases to get the game-time body ready. oBodyBase.OnChangeBodyMode(EBodyBaseModes.Play); Update(); // Manually run the update loop so that Flex delayed-creation gets to run to finalize any softbodies that got created ScenePose_Load("Standing", false); //###G ###DESIGN!! break; case EGameModes.Configure: int nBodyToConfigure = 0; //###TODO#11: Select which body to edit from closest to cam or button? for (int nBody = 0; nBody < _aBodyBases.Length; nBody++) if (nBody != nBodyToConfigure) // First disable all the other bodies so they are not visible to the player during his/her configuration of one body _aBodyBases[nBodyToConfigure].OnChangeBodyMode(EBodyBaseModes.Disabled); _aBodyBases[nBodyToConfigure].OnChangeBodyMode(EBodyBaseModes.Configure); // Enter configuration mode for the selected body break; } HideShowMeshes(); // Hide or show meshes as per configured by our (many) global variables. }
public void OnChangeGameMode(EGameModes eGameModeNew, EGameModes eGameModeOld) { foreach (CJointDriver oJoint in _aJoints) // Propagate the change in game mode to all our joints oJoint.OnChangeGameMode(eGameModeNew, eGameModeOld); //switch (eGameModeNew) { // case EGameModes.Play: // break; // case EGameModes.Configure: // break; //} }