MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setState

Method setState

Engine/source/T3D/player.cpp:2264–2297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2262}
2263
2264void Player::setState(ActionState state, U32 recoverTicks)
2265{
2266 if (state != mState) {
2267 // Skip initialization if there is no manager, the state
2268 // will get reset when the object is added to a manager.
2269 if (isProperlyAdded()) {
2270 switch (state) {
2271 case RecoverState: {
2272 if (mDataBlock->landSequenceTime > 0.0f)
2273 {
2274 // Use the land sequence as the basis for the recovery
2275 setActionThread(PlayerData::LandAnim, true, false, true, true);
2276 F32 timeScale = mShapeInstance->getDuration(mActionAnimation.thread) / mDataBlock->landSequenceTime;
2277 mShapeInstance->setTimeScale(mActionAnimation.thread,timeScale);
2278 mRecoverDelay = mDataBlock->landSequenceTime;
2279 }
2280 else
2281 {
2282 // Legacy recover system
2283 mRecoverTicks = recoverTicks;
2284 mReversePending = U32(F32(mRecoverTicks) / sLandReverseScale);
2285 setActionThread(PlayerData::LandAnim, true, false, true, true);
2286 }
2287 break;
2288 }
2289
2290 default:
2291 break;
2292 }
2293 }
2294
2295 mState = state;
2296 }
2297}
2298
2299void Player::updateState()
2300{

Callers

nothing calls this directly

Calls 3

U32Enum · 0.50
getDurationMethod · 0.45
setTimeScaleMethod · 0.45

Tested by

no test coverage detected