示例#1
0
/**
 * \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,
    const std::shared_ptr<const Stairs>& stairs,
    Stairs::Way way
):
  HeroState(hero, "stairs"),
  stairs(stairs),
  way(way),
  phase(0),
  next_phase_date(0),
  carried_object(nullptr) {

  if (get_previous_carried_object_behavior() == CarriedObject::BEHAVIOR_KEEP) {
    // Keep the carried object of the previous state.
    carried_object = hero.get_carried_object();
  }
}