本文整理汇总了C++中BattleUnit::lookAt方法的典型用法代码示例。如果您正苦于以下问题:C++ BattleUnit::lookAt方法的具体用法?C++ BattleUnit::lookAt怎么用?C++ BattleUnit::lookAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BattleUnit
的用法示例。
在下文中一共展示了BattleUnit::lookAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: think
/*
* Think!
*/
void UnitDieBState::think()
{
if (_unit->getStatus() == STATUS_TURNING)
{
_unit->turn();
}
else if (_unit->getStatus() == STATUS_STANDING)
{
_unit->startFalling();
}
else if (_unit->getStatus() == STATUS_COLLAPSING)
{
_unit->keepFalling();
}
if (_unit->getStatus() == STATUS_DEAD || _unit->getStatus() == STATUS_UNCONSCIOUS)
{
_parent->getMap()->setUnitDying(false);
if (!_unit->getVisibleUnits()->empty())
{
_unit->clearVisibleUnits();
}
if (_unit->getTurnsExposed())
{
_unit->setTurnsExposed(0);
_parent->getSave()->updateExposedUnits();
}
if (!_unit->getSpawnUnit().empty())
{
// converts the dead zombie to a chryssalid
BattleUnit *newUnit = _parent->convertUnit(_unit, _unit->getSpawnUnit());
newUnit->lookAt(_originalDir);
}
else
{
convertUnitToCorpse();
}
_parent->getTileEngine()->calculateUnitLighting();
_parent->popState();
if (_unit->getSpecialAbility() == SPECAB_EXPLODEONDEATH)
{
_unit->instaKill();
if (_damageType != DT_STUN && _damageType != DT_HE)
{
Position p = Position(_unit->getPosition().x * 16, _unit->getPosition().y * 16, _unit->getPosition().z * 24);
_parent->statePushNext(new ExplosionBState(_parent, p, 0, _unit, 0));
}
}
}
_parent->getMap()->cacheUnit(_unit);
}
示例2: think
/*
* Think!
*/
void UnitDieBState::think()
{
if (_unit->getStatus() == STATUS_TURNING)
{
_unit->turn();
}
else if (_unit->getStatus() == STATUS_STANDING)
{
_unit->startFalling();
if (!_noSound)
{
playDeathSound();
}
}
else if (_unit->getStatus() == STATUS_COLLAPSING)
{
_unit->keepFalling();
}
if (_unit->getStatus() == STATUS_DEAD || _unit->getStatus() == STATUS_UNCONSCIOUS)
{
if (_unit->getStatus() == STATUS_UNCONSCIOUS && _unit->getSpecialAbility() == SPECAB_EXPLODEONDEATH)
{
_unit->instaKill();
}
_parent->getMap()->setUnitDying(false);
if (_unit->getTurnsExposed())
{
_unit->setTurnsExposed(0);
_parent->getSave()->updateExposedUnits();
}
if (!_unit->getSpawnUnit().empty())
{
// converts the dead zombie to a chryssalid
BattleUnit *newUnit = _parent->convertUnit(_unit, _unit->getSpawnUnit());
newUnit->lookAt(_originalDir);
}
else
{
convertUnitToCorpse();
}
_parent->getTileEngine()->calculateUnitLighting();
_parent->popState();
if (_unit->getOriginalFaction() == FACTION_PLAYER && _unit->getSpawnUnit().empty())
{
Game *game = _parent->getSave()->getBattleState()->getGame();
if (_unit->getStatus() == STATUS_DEAD)
{
if (_damageType == DT_NONE)
{
std::wstringstream ss;
ss << _unit->getName(game->getLanguage()) << L'\n';
ss << game->getLanguage()->getString("STR_HAS_DIED_FROM_A_FATAL_WOUND", _unit->getGender());
game->pushState(new InfoboxOKState(game, ss.str()));
}
else if (Options::getBool("battleNotifyDeath"))
{
std::wstringstream ss;
ss << _unit->getName(game->getLanguage()) << L'\n';
ss << game->getLanguage()->getString("STR_HAS_BEEN_KILLED", _unit->getGender());
game->pushState(new InfoboxState(game, ss.str()));
}
}
else
{
std::wstringstream ss;
ss << _unit->getName(game->getLanguage()) << L'\n';
ss << game->getLanguage()->getString("STR_HAS_BECOME_UNCONSCIOUS", _unit->getGender());
game->pushState(new InfoboxOKState(game, ss.str()));
}
}
}
// if all units from either faction are killed - auto-end the mission.
if (Options::getBool("battleAutoEnd"))
{
int liveAliens = 0;
int liveSoldiers = 0;
_parent->tallyUnits(liveAliens, liveSoldiers, false);
if (liveAliens == 0 || liveSoldiers == 0)
{
_parent->getSave()->getBattleState()->getBattleGame()->requestEndTurn();
}
}
_parent->getMap()->cacheUnit(_unit);
}