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


C++ SavedBattleGame::getTerrainModifier方法代码示例

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


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

示例1: think

/*
 * Animate explosion sprites. If their animation is finished remove them from the list.
 * If the list is empty, this states is finished.
 */
void ExplosionBState::think()
{
	for (std::set<Explosion*>::const_iterator i = _parent->getMap()->getExplosions()->begin(), inext = i; i != _parent->getMap()->getExplosions()->end(); i = inext)
	{
		++inext;
		if(!(*i)->animate())
		{
			_parent->getMap()->getExplosions()->erase((*i));
			if (_parent->getMap()->getExplosions()->empty())
			{
				SavedBattleGame *save = _parent->getGame()->getSavedGame()->getBattleGame();
				// after the animation is done, the real explosion takes place
				if (_item)
				{
					save->getTerrainModifier()->explode(_center, _item->getRules()->getPower(), _item->getRules()->getDamageType(), 100, _unit);
				}
				if (_tile)
				{
					save->getTerrainModifier()->explode(_center, _tile->getExplosive(), DT_HE, 100, _unit);
				}

				// now check for new casualties
				_parent->checkForCasualties(_item, _unit);

				// if this explosion was caused by a unit shooting, now it's the time to put the gun down and put the camera back on the shooter
				if (_unit && !_unit->isOut())
				{
					_unit->aim(false);
					if (_parent->getMap()->didCameraFollow())
					{
						_parent->getMap()->centerOnPosition(_unit->getPosition());
					}
				}
				_parent->getMap()->cacheUnits();
				_parent->popState();

				// check for terrain explosions
				Tile *t = save->getTerrainModifier()->checkForTerrainExplosions();
				if (t)
				{
					Position p = Position(t->getPosition().x * 16, t->getPosition().y * 16, t->getPosition().z * 24);
					_parent->statePushNext(new ExplosionBState(_parent, p, 0, _unit, t));
				}

				return;
			}
		}
	}
}
开发者ID:jimu,项目名称:OpenXcom,代码行数:53,代码来源:ExplosionBState.cpp


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