本文整理汇总了C++中Hero::get_carried_item方法的典型用法代码示例。如果您正苦于以下问题:C++ Hero::get_carried_item方法的具体用法?C++ Hero::get_carried_item怎么用?C++ Hero::get_carried_item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero::get_carried_item方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: State
/**
* \brief Constructor.
* \param hero The hero controlled by this state.
* \param stairs The stairs to take.
* \param way The way you are taking the stairs.
*/
Hero::StairsState::StairsState(
Hero& hero,
Stairs& stairs,
Stairs::Way way):
State(hero, "stairs"),
stairs(stairs),
way(way),
phase(0),
next_phase_date(0),
carried_item(nullptr) {
if (get_previous_carried_item_behavior() == CarriedItem::BEHAVIOR_KEEP) {
// Keep the carried item of the previous state.
carried_item = hero.get_carried_item();
}
}
示例2: BaseState
/**
* \brief Constructor.
* \param hero The hero controlled by this state.
* \param direction8 Direction of the jump (0 to 7).
* \param distance Distance of the jump in pixels.
* \param ignore_obstacles \c true to make the movement ignore obstacles.
* \param with_sound \c true to play the "jump" sound.
*/
Hero::JumpingState::JumpingState(
Hero& hero,
int direction8,
int distance,
bool ignore_obstacles,
bool with_sound
):
BaseState(hero, "jumping"),
carried_item() {
if (get_previous_carried_item_behavior() == CarriedItem::BEHAVIOR_KEEP) {
// Keep the carried item of the previous state.
carried_item = hero.get_carried_item();
}
this->movement = std::make_shared<JumpMovement>(
direction8, distance, 0, ignore_obstacles
);
this->direction8 = direction8;
this->with_sound = with_sound;
}