本文整理汇总了C++中PlayerInfo::SelectNext方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::SelectNext方法的具体用法?C++ PlayerInfo::SelectNext怎么用?C++ PlayerInfo::SelectNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::SelectNext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateKeys
void AI::UpdateKeys(PlayerInfo &player, bool isActive)
{
shift = (SDL_GetModState() & KMOD_SHIFT);
Command oldHeld = keyHeld;
keyHeld.ReadKeyboard();
keyDown = keyHeld.AndNot(oldHeld);
if(keyHeld.Has(AutopilotCancelKeys()))
keyStuck.Clear();
if(keyStuck.Has(Command::JUMP) && !player.HasTravelPlan())
keyStuck.Clear(Command::JUMP);
const Ship *flagship = player.Flagship();
if(!isActive || !flagship || flagship->IsDestroyed())
return;
// Only toggle the "cloak" command if one of your ships has a cloaking device.
if(keyDown.Has(Command::CLOAK))
for(const auto &it : player.Ships())
if(it->Attributes().Get("cloak"))
{
isCloaking = !isCloaking;
Messages::Add(isCloaking ? "Engaging cloaking device." : "Disengaging cloaking device.");
break;
}
// Toggle your secondary weapon.
if(keyDown.Has(Command::SELECT))
player.SelectNext();
// The commands below here only apply if you have escorts or fighters.
if(player.Ships().size() < 2)
return;
// Only toggle the "deploy" command if one of your ships has fighter bays.
if(keyDown.Has(Command::DEPLOY))
for(const auto &it : player.Ships())
if(it->HasBays())
{
isLaunching = !isLaunching;
Messages::Add(isLaunching ? "Deploying fighters" : "Recalling fighters.");
break;
}
shared_ptr<Ship> target = flagship->GetTargetShip();
if(keyDown.Has(Command::FIGHT) && target)
{
sharedTarget = target;
holdPosition = false;
moveToMe = false;
Messages::Add("All your ships are focusing their fire on \"" + target->Name() + "\".");
}
if(keyDown.Has(Command::HOLD))
{
sharedTarget.reset();
holdPosition = !holdPosition;
moveToMe = false;
Messages::Add(holdPosition ? "Your fleet is holding position."
: "Your fleet is no longer holding position.");
}
if(keyDown.Has(Command::GATHER))
{
sharedTarget.reset();
holdPosition = false;
moveToMe = !moveToMe;
Messages::Add(moveToMe ? "Your fleet is gathering around your flagship."
: "Your fleet is no longer gathering around your flagship.");
}
if(sharedTarget.lock() && sharedTarget.lock()->IsDisabled())
sharedTarget.reset();
}