| 394 | } |
| 395 | |
| 396 | void 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 |
nothing calls this directly
no test coverage detected