当前位置: 首页>>代码示例>>C++>>正文


C++ SimGroup类代码示例

本文整理汇总了C++中SimGroup的典型用法代码示例。如果您正苦于以下问题:C++ SimGroup类的具体用法?C++ SimGroup怎么用?C++ SimGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SimGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: spawnObject

SimObject* SpawnSphere::spawnObject(String additionalProps)
{
   SimObject* spawnObject = Sim::spawnObject(mSpawnClass, mSpawnDataBlock, mSpawnName,
                                             mSpawnProperties + " " + additionalProps, mSpawnScript);

   // If we have a spawnObject add it to the MissionCleanup group
   if (spawnObject)
   {
      if (mSpawnTransform)
      {
         if(SceneObject *s = dynamic_cast<SceneObject*>(spawnObject))
            s->setTransform(getTransform());
      }

      SimObject* cleanup = Sim::findObject("MissionCleanup");

      if (cleanup)
      {
         SimGroup* missionCleanup = dynamic_cast<SimGroup*>(cleanup);

         missionCleanup->addObject(spawnObject);
      }
   }

   return spawnObject;
}
开发者ID:Bloodknight,项目名称:T3D-MIT-GMK-Port,代码行数:26,代码来源:missionMarker.cpp

示例2: preRender

void playDelegate::preRender(void)
{
   if(!gameActive)
      return;

   // try to find a new palette to set in the game:
   if(!currentPalette)
   {
      SimGroup *group = (SimGroup *) manager->findObject("GhostGroup");
      if(group)
      {
         SimGroup::iterator i;
         for(i = group->begin(); i != group->end(); i++)
         {
            SimPalette *pal = dynamic_cast<SimPalette *>(*i);
            if(pal)
            {
               currentPalette = pal;
               deleteNotify(pal);
               hPal = pal->getPalette();
               pal->setInGame();
               break;
            }
         }  
      }
   }
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:27,代码来源:dlgPlay.cpp

示例3: VSoundEffectNetEvent

VTorque::SoundSourceType *VTorque::playSound( SoundEffectType *pSoundProfile, SceneObjectType *pObject, const U32 &pPosition, const F32 &pPitch )
{
    if ( !pSoundProfile )
    {
        // Sanity!
        return NULL;
    }

#ifdef VT_EDITOR

    // Fetch Reference Transform.
    const MatrixF &transform = pObject->getTransform();

    // Play Sound.
    SFXSound *source = ( SFXSound* )SFX->playOnce( pSoundProfile, &transform );

    if ( source )
    {
        // Set Position.
        source->setPosition( pPosition );

        // Set Pitch.
        source->setPitch( pPitch );
    }

    // Return Source.
    return source;

#else

    // Fetch Client Group.
    SimGroup* clientGroup = Sim::getClientGroup();

    for ( SimGroup::iterator itr = clientGroup->begin(); itr != clientGroup->end(); itr++ )
    {
        NetConnection *connection = static_cast<NetConnection*>( *itr );
        if ( connection )
        {
            // Create Event.
            VSoundEffectNetEvent *event = new VSoundEffectNetEvent();

            // Setup Event.
            event->mProfile   = pSoundProfile;
            event->mPosition  = pPosition;
            event->mPitch     = pPitch;
            event->mIs3D      = true;
            event->mTransform = pObject->getTransform();

            // Post Event.
            connection->postNetEvent( event );
        }
    }

    return NULL;

#endif
}
开发者ID:AnteSim,项目名称:Verve,代码行数:57,代码来源:VSoundEffect.cpp

示例4: setPostEffectOn

void VTorque::setPostEffectOn( PostEffectType *pPostEffect, const bool &pStatus )
{
    if ( !pPostEffect )
    {
        // Sanity!
        return;
    }

#ifdef VT_EDITOR

    if ( pStatus )
    {
        // Enable Effect.
        pPostEffect->enable();
    }
    else
    {
        // Disable Effect.
        pPostEffect->disable();
    }

#else

    // Fetch Name.
    StringTableEntry name = pPostEffect->getName();
    if ( !name || name == StringTable->insert( "" ) )
    {
        Con::warnf( "VTorque::setPostEffectOn() - Invalid Object Name." );
        return;
    }

    // Fetch Client Group.
    SimGroup* clientGroup = Sim::getClientGroup();

    for ( SimGroup::iterator itr = clientGroup->begin(); itr != clientGroup->end(); itr++ )
    {
        NetConnection *connection = static_cast<NetConnection*>( *itr );
        if ( connection )
        {
            // Create Event.
            VPostEffectNetEvent *event = new VPostEffectNetEvent();

            // Setup Event.
            event->mPostEffect = name;
            event->mEnabled    = pStatus;

            // Post Event.
            connection->postNetEvent( event );
        }
    }

#endif
}
开发者ID:AnteSim,项目名称:Verve,代码行数:53,代码来源:VPostEffect.cpp

示例5: AssertFatal

void Lightning::warningFlashes()
{
   AssertFatal(isServerObject(), "Error, client objects may not initiate lightning!");


   SimGroup* pClientGroup = Sim::getClientGroup();
   for (SimGroup::iterator itr = pClientGroup->begin(); itr != pClientGroup->end(); itr++) {
      NetConnection* nc = static_cast<NetConnection*>(*itr);
      if (nc != NULL)
      {
         LightningStrikeEvent* pEvent = new LightningStrikeEvent;
         pEvent->mLightning = this;

         nc->postNetEvent(pEvent);
      }
   }
}
开发者ID:GeekOfWires,项目名称:OmniEngine.Net,代码行数:17,代码来源:lightning.cpp

示例6: setCamera

void VTorque::setCamera( SceneObjectType *pObject )
{
    // Fetch Game Base.
    GameBase *object = dynamic_cast<GameBase*>( pObject );

    // Fetch Client Group.
    SimGroup* clientGroup = Sim::getClientGroup();

    for ( SimGroup::iterator itr = clientGroup->begin(); itr != clientGroup->end(); itr++ )
    {
        GameConnection *connection = dynamic_cast<GameConnection*>( *itr );
        if ( connection )
        {
            // Set Camera Object.
            connection->setCameraObject( object );
        }
    }
}
开发者ID:7Sins,项目名称:Verve,代码行数:18,代码来源:VCamera.cpp

示例7: deepClone

SimGroup* SimGroup::deepClone()
{
   // Clone the group object.
   
   SimObject* object = Parent::deepClone();
   SimGroup* group = dynamic_cast< SimGroup* >( object );
   if( !group )
   {
      object->deleteObject();
      return NULL;
   }
   
   // Clone all child objects.
   
   for( iterator iter = begin(); iter != end(); ++ iter )
      group->addObject( ( *iter )->deepClone() );
   
   return group;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:19,代码来源:simSet.cpp

示例8: while

SimObject* SimGroupIterator::operator++()
{
   SimGroup* set;
   if ((set = dynamic_cast<SimGroup*>(*stack.last().itr)) != 0)
   {
      if (!set->empty())
      {
         stack.push_back(set);
         return *stack.last().itr;
      }
   }

   while (++stack.last().itr == stack.last().set->end())
   {
      stack.pop_back();
      if (stack.empty())
         return 0;
   }
   return *stack.last().itr;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:20,代码来源:simSet.cpp

示例9: CompoundUndoAction

void ForestEditorCtrl::deleteMeshSafe( ForestItemData *mesh )
{
   UndoManager *undoMan = NULL;
   if ( !Sim::findObject( "EUndoManager", undoMan ) )
   {
      Con::errorf( "ForestEditorCtrl::deleteMeshSafe() - EUndoManager not found." );
      return;     
   }

   // CompoundUndoAction which will delete the ForestItemData, ForestItem(s), and ForestBrushElement(s).
   CompoundUndoAction *compoundAction = new CompoundUndoAction( "Delete Forest Mesh" );
    
   // Find ForestItem(s) referencing this datablock and add their deletion
   // to the undo action.
   if ( mForest )
   {      
      Vector<ForestItem> foundItems;
      mForest->getData()->getItems( mesh, &foundItems );

      ForestDeleteUndoAction *itemAction = new ForestDeleteUndoAction( mForest->getData(), this );
      itemAction->removeItem( foundItems );
      compoundAction->addAction( itemAction );
   }

   // Find ForestBrushElement(s) referencing this datablock.
   SimGroup *brushGroup = ForestBrush::getGroup();
   sKey = mesh;
   Vector<SimObject*> foundElements;   
   brushGroup->findObjectByCallback( &findMeshReferences, foundElements );   

   // Add UndoAction to delete the ForestBrushElement(s) and the ForestItemData.
   MEDeleteUndoAction *elementAction = new MEDeleteUndoAction();
   elementAction->deleteObject( foundElements );
   elementAction->deleteObject( mesh );
   
   // Add compound action to the UndoManager. Done.
   undoMan->addAction( compoundAction );

   updateCollision();
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:40,代码来源:forestEditorCtrl.cpp

示例10: _assert

void MissionLighting::createInteriorVolume()
{
   VolumeRWStream vol;

   // create the volume
   _assert( vol.createVolume( volumeFile.c_str() ), "Failed to create volume: %s\n",
      volumeFile.c_str() );
      
   SimGroup * group = NULL;
   
   // go through and see if the volume has been added alredy
   for( int i = 0; i < m_volumes.size(); i++ )
   {
      if( ( m_volumes[i]->getName() ) && ( !stricmp( m_volumes[i]->getName(), lightVolName ) ) )
      {
         // remove the volume
         print( V_LOW, "Removing MissionLighting volume.\n" );
         group = m_volumes[i]->getGroup();
         if( group )
            group->removeObject( m_volumes[i] );
      }
   }
   
   print( V_MEDIUM, "Adding SimVolume to mission ( %s )\n",
      volumeFile.c_str() );

   // add to the mission in the volumes group
   SimVolume * simVolume = new SimVolume;
   manager->addObject( simVolume, lightVolName );
   simVolume->open( stripPath( volumeFile.c_str() ) );
   
   // try and place in a volumes group
   if( !group )
   {
      group = dynamic_cast<SimGroup*>( mission->findObject( "Volumes" ) );
      if( !group )
         group = mission;
   }
   group->addObject( simVolume, lightVolName );
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:40,代码来源:MissionLighting.cpp

示例11: addObject

void WorldEditorSelection::addObject( SimObject* obj )
{
   // Return if object is already in selection.
   
   if( objInSet( obj ) )
      return;
      
   // Refuse to add object if this selection is locked.
      
   if( isLocked() )
      return;
      
   // Prevent adding us to ourselves.
      
   if( obj == this )
      return;
      
   // If the object is itself a selection set, make sure we
   // don't create a cycle.
   
   WorldEditorSelection* selection = dynamic_cast< WorldEditorSelection* >( obj );
   if( selection && !selection->objInSet( this ) )
      return;
      
   // Refuse to add any of our parents.
   
   for( SimGroup* group = getGroup(); group != NULL; group = group->getGroup() )
      if( obj == group )
         return;
      
   invalidateCentroid();
   
   Parent::addObject( obj );
      
   if( mAutoSelect )
      WorldEditor::markAsSelected( obj, true );

   return;
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:39,代码来源:worldEditorSelection.cpp

示例12: advanceObjects

void StdServerProcessList::advanceObjects()
{
   #ifdef TORQUE_DEBUG_NET_MOVES
   Con::printf("Advance server time...");
   #endif

   Parent::advanceObjects();

   // Credit all connections with the elapsed tick
   SimGroup *clientGroup = Sim::getClientGroup();
   for(SimGroup::iterator i = clientGroup->begin(); i != clientGroup->end(); i++)
   {
      if (GameConnection *con = dynamic_cast<GameConnection *>(*i))
      {
         con->mMoveList->advanceMove();
      }
   }

   #ifdef TORQUE_DEBUG_NET_MOVES
   Con::printf("---------");
   #endif
}
开发者ID:andr3wmac,项目名称:Torque6,代码行数:22,代码来源:stdGameProcess.cpp

示例13: pos

static const char *c_spawnPlayer(CMDConsole *, int, int argc, const char **argv)
{
   if(!sg.playerManager || !sg.manager || argc != 4)
      return "-1";

   Point3F pos(0, 0, 0), rot(0, 0, 0);
   sscanf( argv[2], "%f %f %f", &pos.x, &pos.y, &pos.z);
   sscanf( argv[3], "%f %f %f", &rot.x, &rot.y, &rot.z);

   Player *player = new Player();
   player->setInitInfo(argv[1], pos, rot);

   if(!sg.manager->registerObject(player))
   {
      delete player;
      return "-1";
   }

   SimGroup *cleanupGroup = (SimGroup *) sg.manager->findObject("MissionCleanup");
   if(cleanupGroup)
      cleanupGroup->addObject(player);
   return intToStr(player->getId());
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:23,代码来源:ScriptPlugin.cpp

示例14: setFirstResponder


//.........这里部分代码省略.........
				setSelectedRoad( clickedRoadPtr );
				setSelectedNode( clickedNodeIdx );

				mAddNodeIdx = clickedNodeIdx;
            mMode = mAddNodeMode;
            mSelNode = mSelRoad->insertNode( tPos, mDefaultWidth, mAddNodeIdx );
            mIsDirty = true;

				return;
         }
			else if ( clickedNodeIdx == clickedRoadPtr->mNodes.size() - 1 )
         {
				setSelectedRoad( clickedRoadPtr );
				setSelectedNode( clickedNodeIdx );

            mAddNodeIdx = U32_MAX;
            mMode = mAddNodeMode;
            mSelNode = mSelRoad->addNode( tPos, mDefaultWidth );
            mIsDirty = true;
				setSelectedNode( mSelNode );

				return;
         } 
		}

		DecalRoad *newRoad = new DecalRoad;
		

		newRoad->mMaterialName = mMaterialName;

      newRoad->registerObject();

      // Add to MissionGroup                              
      SimGroup *missionGroup;
      if ( !Sim::findObject( "MissionGroup", missionGroup ) )               
         Con::errorf( "GuiDecalRoadEditorCtrl - could not find MissionGroup to add new DecalRoad" );
      else
         missionGroup->addObject( newRoad );               

      newRoad->insertNode( tPos, mDefaultWidth, 0 );
      U32 newNode = newRoad->insertNode( tPos, mDefaultWidth, 1 );

      // Always add to the end of the road, the first node is the start.
      mAddNodeIdx = U32_MAX;
      
      setSelectedRoad( newRoad );      
      setSelectedNode( newNode );

      mMode = mAddNodeMode;

      // Disable the hover node while in addNodeMode, we
      // don't want some random node enlarged.
      mHoverNode = -1;

      // Grab the mission editor undo manager.
      UndoManager *undoMan = NULL;
      if ( !Sim::findObject( "EUndoManager", undoMan ) )
      {
         Con::errorf( "GuiRoadEditorCtrl::on3DMouseDown() - EUndoManager not found!" );
         return;           
      }

      // Create the UndoAction.
      MECreateUndoAction *action = new MECreateUndoAction("Create Road");
      action->addObject( newRoad );
      
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:66,代码来源:guiRoadEditorCtrl.cpp

示例15: AIManager

const char * AIPlugin::consoleCallback(CMDConsole*,int id,int argc,const char *argv[])
{
   const char     * returnTxt = 0;
   HandleCmdFunc  listableCommand = 0;

   if( (aim = AIManager::it) == NULL )
   {
      if( sg.manager )
      {
         SimGroup * cleanupGroup = (SimGroup *) sg.manager->findObject(missionCleanup);
      
         if( cleanupGroup == NULL ){
            console->printf( "No cleanup group yet, can't install AI manager and, "
                     "therefore, cannot execute command %s", argv[0] );
            return returnTxt;
         }
         
         aim = new AIManager();
         AssertFatal( aim, "ai: couldn't new() the AIManager." );
         
         if( ! sg.manager->registerObject(aim) ){
            delete aim;
            aim = 0;
            console->printf( "Couldn't register AI manager...  "
                     "Cannot execute command %s", argv[0] );
            return returnTxt;
         }
         else{//success
            sg.manager->assignId(aim,AIManagerId);
            cleanupGroup->addObject(aim);
         }
      }
      else{
         console->printf("No server manager yet, can't install AI manager thus, "
                     "cannot execute command %s.", argv[0] );
         return returnTxt;
      }
   }

   switch( id )
   {
      onCommand(SpawnAI);                          // create an AI.  
      onCommand(List);                             // list all AIs in manager.  
      onCommand(GetAICount);                       // return list size.
      onCommand(GetId);                            // return rep Id.  
      onCommand(GetTarget);                        // return rep Id.  
      onCommand(FetchObject);                      // return SimObjectId

      onListableCommand(AttackPlayer);
      onListableCommand(DeleteAI);
      
      onListableCommand(CallWithId);
      onListableCommand(SetVariable);
      
      onListableCommand(FollowDirective);          // follow the specified player 
      onListableCommand(WaypointDirective);        // add waypoint to list
      onListableCommand(TargetDirective);          // add Target (player rep Id) to list.
      onListableCommand(TargetDirectiveLaser);     //    Use Laser as target (Pt Ok).  
      onListableCommand(TargetDirectivePoint);     //    Fire at given Point.
      //onListableCommand(GuardDirective);         // guard this point or player.  
      onListableCommand(RemoveDirective);          //    remove using order number.
      onListableCommand(ListDirectives);
      onListableCommand(DirectiveCallback1);
      onListableCommand(DirectiveCallback2);
      onListableCommand(DirectiveCallback3);
      onListableCommand(DirectiveCallback4);
      
      onListableCommand(CallbackDied);
      onListableCommand(CallbackPeriodic);
      onListableCommand(SetAutomaticTargets);
      onListableCommand(SetSciptedTargets);
      
#     if INCLUDE_AI_GRAPH_CODE
      onCommand(GraphAddNode);
      onCommand(GraphNodeCount);
      onCommand(GraphLoadNode);
      onCommand(GraphPrintNode);
#     endif
   }

   if( aim )
   {
      if( listableCommand )
      {
         if( argc > 1 )
         {
            // Execute command an all AIs which match the name spec.  
            AIManager::iterator itr;
            for( itr = aim->begin(); itr != aim->end(); itr++ )
               if( (*itr)->nameMatches( argv[1] ) )
                  returnTxt = (this->*listableCommand)( *itr, argc-2, argv+2 );
         }
         else
         {
            // Just give help:
            returnTxt = (this->*listableCommand)( NULL, 0, 0 );
         }
      }
   }
   
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:aiPlugin.cpp


注:本文中的SimGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。