| 1 | // SuperTux |
| 2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
| 3 | // Copyright (C) 2010 Florian Forster <supertux at octo.it> |
| 4 | // |
| 5 | // This program is free software: you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU General Public License as published by |
| 7 | // the Free Software Foundation, either version 3 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | #ifndef HEADER_SUPERTUX_BADGUY_HAYWIRE_HPP |
| 19 | #define |
| 20 | |
| 21 | #include "badguy/walking_badguy.hpp" |
| 22 | |
| 23 | class SoundSource; |
| 24 | |
| 25 | class Haywire final : public WalkingBadguy |
| 26 | { |
| 27 | public: |
| 28 | Haywire(const ReaderMapping& reader); |
| 29 | |
| 30 | virtual void kill_fall() override; |
| 31 | virtual void ignite() override; |
| 32 | |
| 33 | virtual void active_update(float dt_sec) override; |
| 34 | |
| 35 | virtual bool is_freezable() const override; |
| 36 | virtual void freeze() override; |
| 37 | |
| 38 | virtual void stop_looping_sounds() override; |
| 39 | virtual void play_looping_sounds() override; |
| 40 | |
| 41 | virtual std::string get_class() const override { return "haywire" ; } |
| 42 | virtual std::string get_display_name() const override { return _("Haywire" ); } |
| 43 | |
| 44 | protected: |
| 45 | virtual bool collision_squished(GameObject& object) override; |
| 46 | |
| 47 | private: |
| 48 | void start_exploding(); |
| 49 | void stop_exploding(); |
| 50 | |
| 51 | private: |
| 52 | bool is_exploding; |
| 53 | float time_until_explosion; |
| 54 | bool is_stunned; |
| 55 | float time_stunned; |
| 56 | |
| 57 | std::unique_ptr<SoundSource> ticking; |
| 58 | std::unique_ptr<SoundSource> grunting; |
| 59 | |
| 60 | private: |
| 61 | Haywire(const Haywire&) = delete; |
| 62 | Haywire& operator=(const Haywire&) = delete; |
| 63 | }; |
| 64 | |
| 65 | #endif |
| 66 | |
| 67 | /* EOF */ |
| 68 | |