本文整理汇总了C++中PlayerState::extra_weapon_count方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::extra_weapon_count方法的具体用法?C++ PlayerState::extra_weapon_count怎么用?C++ PlayerState::extra_weapon_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::extra_weapon_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WeaponRocket
std::unique_ptr<Weapon>
ObjectManager::create_extra_weapon(int player, PlayerState player_state)
{
std::unique_ptr<Weapon> w;
if (player_state.extra_weapon(player) == "Rocket Weapon") {
sdlc::Sound& sfx = snd[ObjSnd::rocket];
Owner own = Object::parse_owner(player);
w = std::unique_ptr<Weapon>(new WeaponRocket(sfx, own));
w->set_count(player_state.extra_weapon_count(player));
}
return w;
}
示例2: draw_weapons
void Interface::draw_weapons(int x, int y, PlayerState& ps, int player,
sdlc::Font& font, sdlc::Screen& screen)
{
auto length1 = (ps.main_weapon(player)).length();
std::string text1 = (ps.main_weapon(player)).substr(0, length1 - 7);
auto length2 = (ps.extra_weapon(player)).length();
std::string text2 = (ps.extra_weapon(player)).substr(0, length2 - 7);
screen.print(x, y, text1 + " level "
+ std::to_string(ps.main_weapon_level(player)), font);
if (ps.extra_weapon(player) != "none") {
screen.print(x, y + 20, text2 + " count: "
+ std::to_string(ps.extra_weapon_count(player)), font);
}
}