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


C++ ObjectManager::Update方法代码示例

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


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

示例1: PlayGameServer

void PlayGameServer()
{
  r3d_assert(gServerLogic.ginfo_.IsValid());
  switch(gServerLogic.ginfo_.mapId) 
  {
    default: 
      r3dError("invalid map id\n");
      break;
    case GBGameInfo::MAPID_Editor_Particles: 
      r3dGameLevel::SetHomeDir("WorkInProgress\\Editor_Particles"); 
      break;
    case GBGameInfo::MAPID_ServerTest:
      r3dGameLevel::SetHomeDir("WorkInProgress\\ServerTest");
      break;
    case GBGameInfo::MAPID_WZ_Colorado: 
      r3dGameLevel::SetHomeDir("WZ_Colorado"); 
      break;
	      case GBGameInfo::MAPID_Laskar: 
      r3dGameLevel::SetHomeDir("Laskar_Village_V2"); 
      break;
	      case GBGameInfo::MAPID_WZ_Cliffside_Farm: 
      r3dGameLevel::SetHomeDir("WZ_Cliffside_Farm"); 
      break;
	      case GBGameInfo::MAPID_WZ_RaccoonCity: 
      r3dGameLevel::SetHomeDir("WZ_RaccoonCity"); 
      break;
	     case GBGameInfo::MAPID_WZ_RaccoonCity_Premium: 
      r3dGameLevel::SetHomeDir("WZ_RaccoonCity_Premium"); 
      break;
	     case GBGameInfo::MAPID_WZ_CARCANFLY: 
      r3dGameLevel::SetHomeDir("WZ_CARCANFLY"); 
      break;
     case GBGameInfo::MAPID_WZ_Cliffside_PVP: 
      r3dGameLevel::SetHomeDir("WZ_Cliffside_PVP"); 
      break;
	  	case GBGameInfo::MAPID_wo_wasteland: 
		r3dGameLevel::SetHomeDir("wo_wasteland"); 
		break;
		case GBGameInfo::MAPID_wo_inferno: 
		r3dGameLevel::SetHomeDir("wo_inferno"); 
		break;
		case GBGameInfo::MAPID_wo_eastern_bunker_tdm: 
		r3dGameLevel::SetHomeDir("wo_eastern_bunker_tdm"); 
		break;
		case GBGameInfo::MAPID_WO_Grozny: 
		r3dGameLevel::SetHomeDir("WO_Grozny"); 
		break;
		case GBGameInfo::MAPID_wo_shippingyard: 
		r3dGameLevel::SetHomeDir("wo_shippingyard"); 
		break;
  }

  r3dResetFrameTime();
  
  GameWorld_Create();

  u_srand(timeGetTime());
  GameWorld().Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  ServerDummyWorld.Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  
  g_pPhysicsWorld = new PhysXWorld;
  g_pPhysicsWorld->Init();

  r3dTerrain::SetNeedShaders( false );
  LoadLevel_Objects( 1.f );

  gCollectionsManager.Init( 0, 1 );

  r3dOutToLog( "NavMesh.Load...\n" );
  gAutodeskNavMesh.Init();

  r3dResetFrameTime();
  GameWorld().Update();
  ServerDummyWorld.Update();

  r3dOutToLog("Spawning Vehicles... Count:%d\n",GameWorld().spawncar);
  gServerLogic.SpawnNewCar();

  r3dGameLevel::SetStartGameTime(r3dGetTime());
  
  r3dOutToLog("server main loop started\n");
  r3dResetFrameTime();
  gServerLogic.OnGameStart();
  
  gKeepAliveReporter.SetStarted(true);
  
  while(1) 
  {
    ::Sleep(20);		// limit to 100 FPS
    
    r3dEndFrame();
    r3dStartFrame();
    
    //if(GetAsyncKeyState(VK_F1)&0x8000) r3dError("r3dError test");
    //if(GetAsyncKeyState(VK_F2)&0x8000) r3d_assert(false && "r3d_Assert test");
    gKeepAliveReporter.Tick(gServerLogic.curPlayers_);

    gServerLogic.Tick();
    gMasterServerLogic.Tick();
    
//.........这里部分代码省略.........
开发者ID:Mateuus,项目名称:devsrc,代码行数:101,代码来源:ServerGame.cpp

示例2: PlayGameServer

/*static unsigned int WINAPI NetworkThread( void * param )
{
	while(1)
	{
	::Sleep(1);
	gServerLogic.net_->Update();
	}
}*/
void PlayGameServer()
{
  r3d_assert(gServerLogic.ginfo_.IsValid());
  switch(gServerLogic.ginfo_.mapId) 
  {
    default: 
      r3dError("invalid map id\n");
      break;
    case GBGameInfo::MAPID_Editor_Particles: 
      r3dGameLevel::SetHomeDir("WorkInProgress\\Editor_Particles"); 
      break;
    case GBGameInfo::MAPID_ServerTest:
      r3dGameLevel::SetHomeDir("WorkInProgress\\ServerTest");
      break;
    case GBGameInfo::MAPID_WZ_Colorado:
      r3dGameLevel::SetHomeDir("WZ_Colorado");
      break;
	case GBGameInfo::MAPID_UB_Cliffside:
      r3dGameLevel::SetHomeDir("WZ_Cliffside");
      break;
    case GBGameInfo::MAPID_UB_CaliWood:
      r3dGameLevel::SetHomeDir("CaliWood");
      break;
    case GBGameInfo::MAPID_UB_Valley:
      r3dGameLevel::SetHomeDir("UB_Valley");
      break;
    case GBGameInfo::MAPID_UB_Area51:
      r3dGameLevel::SetHomeDir("UB_Deserto");
      break;
	case GBGameInfo::MAPID_UB_CryZ:
      r3dGameLevel::SetHomeDir("UB_CryZ");
      break;
  	case GBGameInfo::MAPID_UB_Terra:
      r3dGameLevel::SetHomeDir("UB_Terra");
      break;
  	case GBGameInfo::MAPID_UB_Mega:
      r3dGameLevel::SetHomeDir("UB_Mega");
      break;
  }

  r3dResetFrameTime();
  
  GameWorld_Create();

  u_srand(timeGetTime());
  GameWorld().Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  ServerDummyWorld.Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  
  g_pPhysicsWorld = new PhysXWorld;
  g_pPhysicsWorld->Init();

  r3dTerrain::SetNeedShaders( false );
  LoadLevel_Objects( 1.f );

  gCollectionsManager.Init( 0, 1 );

  r3dOutToLog( "NavMesh.Load...\n" );
  gAutodeskNavMesh.Init();

  r3dResetFrameTime();
  GameWorld().Update();
  ServerDummyWorld.Update();

  r3dGameLevel::SetStartGameTime(r3dGetTime());
  
  r3dOutToLog("server main loop started\n");
  r3dResetFrameTime();
  gServerLogic.OnGameStart();
  
  gKeepAliveReporter.SetStarted(true);
  
 // _beginthreadex ( NULL, 0, NetworkThread, NULL, 0, NULL );
  while(1) 
  {
    ::Sleep(20);		// limit to 100 FPS

	char text[64] ={0};
	sprintf(text,"WarZ Game Server [Running..] id:%d curPeer:%d players:%d/%d",gServerLogic.ginfo_.gameServerId,gServerLogic.curPeersConnected,gServerLogic.curPlayers_,gServerLogic.ginfo_.maxPlayers);
	SetConsoleTitle(text);

	gServerLogic.net_->Update();

    r3dEndFrame();
    r3dStartFrame();
    
    //if(GetAsyncKeyState(VK_F1)&0x8000) r3dError("r3dError test");
    //if(GetAsyncKeyState(VK_F2)&0x8000) r3d_assert(false && "r3d_Assert test");
    gKeepAliveReporter.Tick(gServerLogic.curPlayers_);

    gServerLogic.Tick();
	gServerLogic.UpdateNetId();
    gMasterServerLogic.Tick();
//.........这里部分代码省略.........
开发者ID:hotza0012345,项目名称:devwarzth,代码行数:101,代码来源:ServerGame.cpp


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