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


C++ Boss::setElapsedTime方法代码示例

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


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

示例1: ResetGame

void Game::ResetGame()
{
  std::vector<std::string> enemies;
  enemies.push_back("Enemy1");
  enemies.push_back("Enemy2");
  enemies.push_back("Enemy3");

  for(unsigned int i = 0; i < enemies.size(); i++)
  {
  AIShip* enemy = dynamic_cast<AIShip*>(Game::GetGameObjectManager().Get(enemies[i]));
	assert(NULL != enemy);
	
	enemy->setElapsedTime(0);
  }
  WeaponPowerUp* weapon = dynamic_cast<WeaponPowerUp*>(Game::GetGameObjectManager().Get("WeaponPowerUp"));
  assert(NULL != weapon);
  weapon->setPowerUpLevel(1);
  weapon->setElapsedTime(20.f);
  weapon->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
  
  ShieldPowerUp* shield = dynamic_cast<ShieldPowerUp*>(Game::GetGameObjectManager().Get("ShieldPowerUp"));
  assert(NULL != weapon);
  shield->setElapsedTime(10.f);
  shield->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
  _score = 0;

  Boss* boss = dynamic_cast<Boss*>(Game::GetGameObjectManager().Get("Boss"));
  assert(NULL != boss);
  boss->setElapsedTime(0.f);

   AILaser* laser1 = dynamic_cast<AILaser*>(Game::GetGameObjectManager().Get("AILaser1"));
  assert(NULL != laser1);
  laser1->setElapsedTime(0.f);
  laser1->setSpeed(0.f);
  laser1->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);

  AILaser2* laser2 = dynamic_cast<AILaser2*>(Game::GetGameObjectManager().Get("AILaser2"));
  assert(NULL != laser2);
  laser2->setElapsedTime(0.f);
  laser2->setSpeed(0.f);
  laser2->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);

  AILaser3* laser3 = dynamic_cast<AILaser3*>(Game::GetGameObjectManager().Get("AILaser3"));
  assert(NULL != laser3);
  laser3->setElapsedTime(0.f);
  laser3->setSpeed(0.f);
  laser3->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);

  BossLaser* blaser = dynamic_cast<BossLaser*>(Game::GetGameObjectManager().Get("BossLaser"));
  assert(NULL != blaser);
  blaser->setElapsedTime(0.f);
  blaser->setSpeed(0.f,0.f);
  blaser->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);




  
}
开发者ID:NicodySazawa,项目名称:Paint_Wars_C_Plus_Plus_Sample,代码行数:59,代码来源:game.cpp


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