00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef HEADER_SUPERTUX_BADGUY_WILLOWISP_HPP
00018 #define HEADER_SUPERTUX_BADGUY_WILLOWISP_HPP
00019
00020 #include "badguy/badguy.hpp"
00021
00022 class Path;
00023 class PathWalker;
00024 class SoundSource;
00025
00026 #include "scripting/willowisp.hpp"
00027 #include "supertux/script_interface.hpp"
00028
00029 class WillOWisp : public BadGuy,
00030 public scripting::WillOWisp,
00031 public ScriptInterface
00032 {
00033 public:
00034 WillOWisp(const Reader& reader);
00035
00036 void activate();
00037 void deactivate();
00038
00039 void active_update(float elapsed_time);
00040 virtual bool is_flammable() const { return false; }
00041 virtual bool is_freezable() const { return false; }
00042 virtual void kill_fall() { vanish(); }
00043
00047 void vanish();
00048
00049 virtual void draw(DrawingContext& context);
00050
00051 virtual void goto_node(int node_no);
00052 virtual void set_state(const std::string& state);
00053 virtual void start_moving();
00054 virtual void stop_moving();
00055
00056 virtual void expose(HSQUIRRELVM vm, SQInteger table_idx);
00057 virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx);
00058
00059 protected:
00060 virtual bool collides(GameObject& other, const CollisionHit& hit);
00061 HitResponse collision_player(Player& player, const CollisionHit& hit);
00062
00063 private:
00064 enum MyState {
00065 STATE_STOPPED, STATE_IDLE, STATE_TRACKING, STATE_VANISHING, STATE_WARPING,
00066 STATE_PATHMOVING, STATE_PATHMOVING_TRACK
00067 };
00068
00069 private:
00070 MyState mystate;
00071
00072 std::string target_sector;
00073 std::string target_spawnpoint;
00074 std::string hit_script;
00075
00076 std::auto_ptr<SoundSource> sound_source;
00077
00078 std::auto_ptr<Path> path;
00079 std::auto_ptr<PathWalker> walker;
00080
00081 float flyspeed;
00082 float track_range;
00083 float vanish_range;
00084 };
00085
00086 #endif
00087
00088