当前位置: 首页>>代码示例>>C++>>正文


C++ Hero::get_carried_item方法代码示例

本文整理汇总了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();
  }
}
开发者ID:Fordi,项目名称:Solarus-PSP,代码行数:22,代码来源:StairsState.cpp

示例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;
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:29,代码来源:JumpingState.cpp


注:本文中的Hero::get_carried_item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。