本文整理汇总了C++中Heroes::Move2Dest方法的典型用法代码示例。如果您正苦于以下问题:C++ Heroes::Move2Dest方法的具体用法?C++ Heroes::Move2Dest怎么用?C++ Heroes::Move2Dest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Heroes
的用法示例。
在下文中一共展示了Heroes::Move2Dest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HeroesTownGate
bool HeroesTownGate(Heroes & hero, const Castle* castle)
{
if(castle)
{
Interface::Basic & I = Interface::Basic::Get();
const s32 src = hero.GetIndex();
const s32 dst = castle->GetIndex();
if(!Maps::isValidAbsIndex(src) || !Maps::isValidAbsIndex(dst))
return false;
AGG::PlaySound(M82::KILLFADE);
hero.GetPath().Hide();
hero.FadeOut();
Cursor::Get().Hide();
hero.Move2Dest(dst);
I.gameArea.SetCenter(hero.GetCenter());
GameFocus::SetRedraw();
I.Redraw();
AGG::PlaySound(M82::KILLFADE);
hero.GetPath().Hide();
hero.FadeIn();
// educate spells
if(! Settings::Get().ExtHeroLearnSpellsWithDay()) castle->MageGuildEducateHero(hero);
return true;
}
return false;
}
示例2: ActionSpellDimensionDoor
bool ActionSpellDimensionDoor(Heroes & hero)
{
const u8 distance = Spell::CalculateDimensionDoorDistance(hero.GetPower(), hero.GetArmy().GetHitPoints());
Interface::Basic & I = Interface::Basic::Get();
Cursor & cursor = Cursor::Get();
// center hero
cursor.Hide();
I.gameArea.SetCenter(hero.GetCenter());
GameFocus::SetRedraw();
I.Redraw();
const s32 src = hero.GetIndex();
// get destination
const s32 dst = I.GetDimensionDoorDestination(src, distance, hero.isShipMaster());
if(Maps::isValidAbsIndex(src) && Maps::isValidAbsIndex(dst))
{
AGG::PlaySound(M82::KILLFADE);
hero.GetPath().Reset();
hero.FadeOut();
hero.SpellCasted(Spell::DIMENSIONDOOR);
cursor.Hide();
hero.Move2Dest(dst, true);
I.gameArea.SetCenter(hero.GetCenter());
GameFocus::SetRedraw();
I.Redraw();
AGG::PlaySound(M82::KILLFADE);
hero.FadeIn();
hero.ActionNewPosition();
return false; /* SpellCasted apply */
}
return false;
}
示例3: MoveStep
void Heroes::MoveStep(Heroes & hero, s32 index_from, s32 index_to, bool newpos)
{
if(newpos)
{
hero.Move2Dest(index_to);
hero.GetPath().PopFront();
// possible hero is die
if(!hero.isFreeman() &&
index_to == hero.GetPath().GetDestinationIndex())
{
hero.GetPath().Reset();
hero.Action(index_to);
hero.SetMove(false);
}
}
else
{
hero.ApplyPenaltyMovement();
hero.GetPath().Reset();
hero.Action(index_to);
hero.SetMove(false);
}
}