本文整理汇总了C++中PlayerState::main_weapon方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::main_weapon方法的具体用法?C++ PlayerState::main_weapon怎么用?C++ PlayerState::main_weapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::main_weapon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: WeaponBlaster
std::unique_ptr<Weapon>
ObjectManager::create_main_weapon(int player, PlayerState player_state)
{
std::unique_ptr<Weapon> w;
if (player_state.main_weapon(player) == "Blaster Weapon") {
sdlc::Sound& sfx = snd[ObjSnd::blaster];
Owner own = Object::parse_owner(player);
w = std::unique_ptr<Weapon>(new WeaponBlaster(sfx, own));
}
for (int j = 1; j < player_state.main_weapon_level(player); ++j)
w->upgrade();
return w;
}