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

Method processTick

Engine/source/T3D/proximityMine.cpp:396–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396void ProximityMine::processTick( const Move* move )
397{
398 Parent::processTick( move );
399
400 // Process state machine
401 mStateTimeout -= TickSec;
402
403 State lastState = NumStates;;
404 while ( mState != lastState )
405 {
406 lastState = mState;
407 switch ( mState )
408 {
409 case Thrown:
410 if ( mAtRest )
411 {
412 mState = Deployed;
413 mStateTimeout = mDataBlock->armingDelay;
414
415 // Get deployed position if mine was not stuck to another surface
416 if ( mStickyCollisionPos.isZero() )
417 {
418 mObjToWorld.getColumn( 2, &mStickyCollisionNormal );
419 mObjToWorld.getColumn( 3, &mStickyCollisionPos );
420 }
421 setDeployedPos( mStickyCollisionPos, mStickyCollisionNormal );
422
423 if ( mDataBlock->armingSequence != -1 )
424 {
425 mAnimThread = mShapeInstance->addThread();
426 mShapeInstance->setSequence( mAnimThread, mDataBlock->armingSequence, 0.0f );
427 }
428 if ( mDataBlock->getArmSoundProfile() )
429 SFX->playOnce( mDataBlock->getArmSoundProfile(), &getRenderTransform() );
430 }
431 break;
432
433 case Deployed:
434 // Timeout into Armed state
435 if ( mStateTimeout <= 0 )
436 {
437 mState = Armed;
438 mStateTimeout = mDataBlock->autoTriggerDelay ? mDataBlock->autoTriggerDelay : F32_MAX;
439 }
440 break;
441
442 case Armed:
443 {
444 // Check for objects within the trigger area
445 Box3F triggerBox( mDataBlock->triggerRadius * 2 );
446 triggerBox.setCenter( getTransform().getPosition() );
447
448 SimpleQueryList sql;
449 getContainer()->findObjects( triggerBox, sTriggerCollisionMask,
450 SimpleQueryList::insertionCallback, &sql );
451 for ( S32 i = 0; i < sql.mList.size(); i++ )
452 {
453 // Detect movement in the trigger area

Callers

nothing calls this directly

Calls 13

getColumnMethod · 0.80
setCenterMethod · 0.80
findObjectsMethod · 0.80
getContainerFunction · 0.50
isZeroMethod · 0.45
addThreadMethod · 0.45
setSequenceMethod · 0.45
playOnceMethod · 0.45
getPositionMethod · 0.45
sizeMethod · 0.45
lenMethod · 0.45
getVelocityMethod · 0.45

Tested by

no test coverage detected