src/badguy/treewillowisp.hpp

Go to the documentation of this file.
00001 //  SuperTux - "Will-O-Wisp" Badguy
00002 //  Copyright (C) 2007 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_BADGUY_TREEWILLOWISP_HPP
00018 #define HEADER_SUPERTUX_BADGUY_TREEWILLOWISP_HPP
00019 
00020 #include "badguy/badguy.hpp"
00021 
00022 class GhostTree;
00023 class SoundSource;
00024 
00025 class TreeWillOWisp : public BadGuy
00026 {
00027 public:
00028   TreeWillOWisp(GhostTree* tree, const Vector& pos, float radius, float speed);
00029   virtual ~TreeWillOWisp();
00030 
00031   void activate();
00032 
00036   void vanish();
00037   void start_sucking(Vector suck_target);
00038 
00039   void active_update(float elapsed_time);
00040   void set_color(const Color& color);
00041   Color get_color() const;
00042 
00043   virtual bool is_flammable() const { return false; }
00044   virtual bool is_freezable() const { return false; }
00045   virtual void kill_fall() { vanish(); }
00046 
00047   virtual void draw(DrawingContext& context);
00048 
00049 protected:
00050   virtual bool collides(GameObject& other, const CollisionHit& hit);
00051   HitResponse collision_player(Player& player, const CollisionHit& hit);
00052 
00053 private:
00054   enum MyState {
00055     STATE_DEFAULT, STATE_VANISHING, STATE_SUCKED
00056   };
00057 
00058 public:
00059   bool was_sucked;
00060 
00061 private:
00062   MyState mystate;
00063 
00064   Color color;
00065   float angle;
00066   float radius;
00067   float speed;
00068 
00069   std::auto_ptr<SoundSource> sound_source;
00070   GhostTree* tree;
00071 
00072   Vector suck_target;
00073 
00074 private:
00075   TreeWillOWisp(const TreeWillOWisp&);
00076   TreeWillOWisp& operator=(const TreeWillOWisp&);
00077 };
00078 
00079 #endif
00080 
00081 /* EOF */

Generated on Mon Jun 9 03:38:17 2014 for SuperTux by  doxygen 1.5.1