本文整理汇总了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;
}
}
}
}