void AITurretShape::advanceTime(F32 dt) { // If there were any ShapeBase script threads that // have played, then we need to update all code // controlled nodes. This is done before the Parent // call as script threads may play and be destroyed // before our code is called. bool updateNodes = false; for (U32 i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if (st.thread) { updateNodes = true; break; } } Parent::advanceTime(dt); // Update any state thread AITurretShapeData::StateData& stateData = *mState; if (mStateAnimThread && stateData.sequence != -1) { mShapeInstance->advanceTime(dt,mStateAnimThread); updateNodes = true; } if (updateNodes) { // Update all code controlled nodes _updateNodes(mRot); } }
//--------------------------------------------------------------------------- // update running entities (init/exit/runtime change) //--------------------------------------------------------------------------- bool Config::_updateRunning( const bool canFail ) { if( _state == STATE_STOPPED ) return true; LBASSERT( _state == STATE_RUNNING || _state == STATE_INITIALIZING || _state == STATE_EXITING ); if( !_connectNodes() && !canFail ) return false; _startNodes(); _updateCanvases(); const bool result = _updateNodes( canFail ); _stopNodes(); // Don't use visitor, it would get confused with modified child vectors _deleteEntities( getCanvases( )); _deleteEntities( getLayouts( )); _deleteEntities( getObservers( )); const Nodes& nodes = getNodes(); for( Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i ) { const Pipes& pipes = (*i)->getPipes(); for( Pipes::const_iterator j = pipes.begin(); j != pipes.end(); ++j ) { const Windows& windows = (*j)->getWindows(); _deleteEntities( windows ); } } return result; }
void TurretShape::advanceTime(F32 dt) { // If there were any ShapeBase script threads that // have played, then we need to update all code // controlled nodes. This is done before the Parent // call as script threads may play and be destroyed // before our code is called. bool updateNodes = false; for (U32 i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if (st.thread) { updateNodes = true; break; } } // If there is a recoil or image-based thread then // we also need to update the nodes. if (mRecoilThread || mImageStateThread) updateNodes = true; Parent::advanceTime(dt); updateAnimation(dt); if (updateNodes) { _updateNodes(mRot); } }
void TurretShape::_setRotation(const Point3F& rot) { _updateNodes(rot); mShapeInstance->animate(); mRot = rot; }