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

Method updateState

Engine/source/T3D/player.cpp:2299–2352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2297}
2298
2299void Player::updateState()
2300{
2301 switch (mState)
2302 {
2303 case RecoverState:
2304 if (mDataBlock->landSequenceTime > 0.0f)
2305 {
2306 // Count down the land time
2307 mRecoverDelay -= TickSec;
2308 if (mRecoverDelay <= 0.0f)
2309 {
2310 setState(MoveState);
2311 }
2312 }
2313 else
2314 {
2315 // Legacy recover system
2316 if (mRecoverTicks-- <= 0)
2317 {
2318 if (mReversePending && mActionAnimation.action != PlayerData::NullAnimation)
2319 {
2320 // this serves and counter, and direction state
2321 mRecoverTicks = mReversePending;
2322 mActionAnimation.forward = false;
2323
2324 S32 seq = mDataBlock->actionList[mActionAnimation.action].sequence;
2325 S32 imageBasedSeq = convertActionToImagePrefix(mActionAnimation.action);
2326 if (imageBasedSeq != -1)
2327 seq = imageBasedSeq;
2328
2329 F32 pos = mShapeInstance->getPos(mActionAnimation.thread);
2330
2331 mShapeInstance->setTimeScale(mActionAnimation.thread, -sLandReverseScale);
2332 mShapeInstance->transitionToSequence(mActionAnimation.thread,
2333 seq, pos, sAnimationTransitionTime, true);
2334 mReversePending = 0;
2335 }
2336 else
2337 {
2338 setState(MoveState);
2339 }
2340 } // Stand back up slowly only if not moving much-
2341 else if (!mReversePending && mVelocity.lenSquared() > sSlowStandThreshSquared)
2342 {
2343 mActionAnimation.waitForEnd = false;
2344 setState(MoveState);
2345 }
2346 }
2347 break;
2348
2349 default:
2350 break;
2351 }
2352}
2353
2354const char* Player::getStateName()
2355{

Callers

nothing calls this directly

Calls 4

transitionToSequenceMethod · 0.80
getPosMethod · 0.45
setTimeScaleMethod · 0.45
lenSquaredMethod · 0.45

Tested by

no test coverage detected