void MapOverview::OnMotion(wxMouseEvent& event) { wxSleep(0.01); if ( event.LeftIsDown()==1 ) { int x=event.GetX(); int y=event.GetY(); if ( XYOverFeed(x,y)==1 ) { // Meta ta X,Y tha periexoun nees plirofories if ( set_point_flag == 1 ) { wxString tmp; tmp.clear() , tmp<<x , TextCurPosX->SetValue(tmp); tmp.clear() , tmp<<y , TextCurPosY->SetValue(tmp); //StatusBar1->SetStatusText(wxT("Set Start point")); SetAgentLocation(GetWorldHandler(),OURROBOT,x,y); wxCommandEvent nullevent; OnButtonExecuteClick(nullevent); } else if ( set_point_flag == 2 ) { wxString tmp; tmp.clear() , tmp<<x , TextTargetPosX->SetValue(tmp); tmp.clear() , tmp<<y , TextTargetPosY->SetValue(tmp); //StatusBar1->SetStatusText(wxT("Set End point")); SetAgentTargetLocation(GetWorldHandler(),OURROBOT,x,y); wxCommandEvent nullevent; OnButtonExecuteClick(nullevent); } else { SetObstacle(GetWorldHandler(),x,y,OBSTACLE_UNCERTAINTY) ; Refresh(); } set_point_flag=0; } } else if ( event.RightIsDown()==1 ) { int x=event.GetX(); int y=event.GetY(); if ( XYOverFeed(x,y)==1 ) { RemoveObstacle(GetWorldHandler(),x,y,OBSTACLE_UNCERTAINTY); Refresh(); } } return; }
BOOL KDoodad::UpdateObstacle() { BOOL bRetCode = FALSE; bRetCode = RemoveObstacle(); KGLOG_CHECK_ERROR(bRetCode); bRetCode = ApplyObstacle(); KGLOG_PROCESS_ERROR(bRetCode); bRetCode = TRUE; Exit0: return bRetCode; }
void CChildView::OnRButtonUp(UINT nFlags, CPoint point) { switch (_LMBState) { case ELMBState::AddCircleObstacle: case ELMBState::AddOBBObstacle: RemoveObstacle(point); break; case ELMBState::IntersectSegment: { _intersectsegment.ChangeDestination(Vector2Df(point)); CheckIntersect(); Invalidate(); break; } } __super::OnRButtonUp(nFlags, point); }
void RPG_DestructibleEntity::SetDestroyed() { m_isDestroyed = true; // remove the attackable component RPG_AttackableComponent* attackableComponent = static_cast<RPG_AttackableComponent*>(Components().GetComponentOfType(V_RUNTIME_CLASS(RPG_AttackableComponent))); if (attackableComponent) { RemoveComponent(attackableComponent); } vHavokRigidBody* rigidBodyComponent = static_cast<vHavokRigidBody*>(Components().GetComponentOfType(V_RUNTIME_CLASS(vHavokRigidBody))); if (rigidBodyComponent) { RemoveComponent(rigidBodyComponent); } // stop the ambient effect StopEffect(DEFX_Ambient); CreateEffect(DEFX_Destroy, GetPosition(), GetOrientation()); // remove collision if so instructed //if (m_removeCollisionAfterDestruction) { RemoveObstacle(); } if(!m_postDestructionMeshFilename.IsEmpty()) { // swap the mesh SetMesh(m_postDestructionMeshFilename); } else { DisposeObject(); } }
//update that checks the loaded list for adding or removing objects inside void MapManager::UpdateLoadedList(std::vector<MapArea*> *input) { //run through our current list //see if there is anything in the list to be updated std::vector<MapArea*>::iterator loadedIterator; for(loadedIterator = input->begin(); loadedIterator != input->end(); loadedIterator++) { //No matter if the area is fully inside or not, let's check if the area is now outside of the HOLDRADIUS if(!IsAreaInsideLoadRadius((*loadedIterator))) { if(!IsAreaInsideHoldRadius((*loadedIterator))) { //now, time to remove the area node //std::cout << "REMOVING AREA NODE!\n"; char areaString[30]; sprintf(areaString, "map_area_%d", (*loadedIterator)->getIndex()); //get the area node from map node. Ogre::SceneNode* areaNode = (Ogre::SceneNode*)mMapNode->getChild(Ogre::String(areaString)); //delete ground node char groundString[30]; sprintf(groundString, "map_area_ground_%d", (*loadedIterator)->getIndex()); Ogre::SceneNode* groundNode = (Ogre::SceneNode*)areaNode->getChild(Ogre::String(groundString)); groundNode->removeAndDestroyAllChildren(); groundNode->detachAllObjects(); areaNode->removeAndDestroyChild(groundString); areaNode->removeAndDestroyAllChildren(); areaNode->detachAllObjects(); mMapNode->removeAndDestroyChild(areaString); //set the map area to be unloaded (*loadedIterator)->setLoaded(false); //remove it from the list input->erase(loadedIterator); return; } } //since this area is not fully inside, lets check if this object is currently inside the scene std::vector<Objects*>::iterator obstacleIterator; for(obstacleIterator = (*loadedIterator)->_mObstacleList.begin(); obstacleIterator!=(*loadedIterator)->_mObstacleList.end(); obstacleIterator++) { //is this object in the load radius? if(IsObjectInsideRadius((*obstacleIterator), LOADRADIUS)) { //yes //is this object already loaded in the game? if((*obstacleIterator)->mLoaded) { //yes //skip continue; } else { //no //add it into the game AddObstacle((*loadedIterator), (*obstacleIterator)); } } //is this object out of hold radius? else if(!IsObjectInsideRadius((*obstacleIterator), HOLDRADIUS)) { //no //is this object already loaded in the game? if((*obstacleIterator)->mLoaded) { //yes //remove it RemoveObstacle((*loadedIterator),(*obstacleIterator)); } else { //no //skip continue; } } } std::vector<Objects*>::iterator enemyIterator; for(enemyIterator = (*loadedIterator)->_mEnemySpawnPointList.begin(); enemyIterator!=(*loadedIterator)->_mEnemySpawnPointList.end(); enemyIterator++) { //is this object inside the load radius? if(IsObjectInsideRadius((*enemyIterator), ENEMY_LOADRADIUS)) { //yes //is this enemy spawn point already loaded? if(!(*enemyIterator)->mLoaded) { //no //add enemy AddEnemy((*enemyIterator)); } } } std::vector<Objects*>::iterator flamethrowerIterator; for(flamethrowerIterator = (*loadedIterator)->_mFlameThrowerList.begin(); flamethrowerIterator!=(*loadedIterator)->_mFlameThrowerList.end(); flamethrowerIterator++) { //no //is this object inside the load radius? if(!IsObjectInsideRadius((*flamethrowerIterator), ENEMY_LOADRADIUS)) { //no //skip this object continue; } //yes continue whatever we need to do if(!(*flamethrowerIterator)->mLoaded) AddFlameThrower((*flamethrowerIterator)); } } }
void RPG_DestructibleEntity::DisposeObject() { RemoveObstacle(); RPG_DamageableEntity::DisposeObject(); }