1 /* 2 * Copyright (C) 2006-2019 Christopho, Solarus - http://www.solarus-games.org 3 * 4 * Solarus is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * Solarus is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 #ifndef SOLARUS_HERO_LIFTING_STATE_H 18 #define SOLARUS_HERO_LIFTING_STATE_H 19 20 #include "solarus/core/Common.h" 21 #include "solarus/entities/EntityState.h" 22 #include <memory> 23 24 namespace Solarus { 25 26 /** 27 * \brief The state "Lifting" of the hero. 28 */ 29 class Hero::LiftingState: public HeroState { 30 31 public: 32 33 LiftingState(Hero& hero, const std::shared_ptr<CarriedObject>& lifted_item); 34 35 void start(const State* previous_state) override; 36 void stop(const State* next_state) override; 37 void update() override; 38 void set_suspended(bool suspended) override; 39 bool get_can_be_hurt(Entity* attacker) override; 40 std::shared_ptr<CarriedObject> get_carried_object() const override; 41 42 private: 43 44 void throw_item(); 45 46 std::shared_ptr<CarriedObject> lifted_item; /**< the item currently being lifted */ 47 }; 48 49 } 50 51 #endif 52 53