YAPOG  0.0.1
Yet Another Pokemon Online Game
DynamicWorldObject.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_DYNAMICWORLDOBJECT_HPP
2 # define YAPOG_DYNAMICWORLDOBJECT_HPP
3 
4 # include "YAPOG/Macros.hpp"
7 # include "YAPOG/Game/ID.hpp"
12 
13 namespace yap
14 {
15  struct IDynamicWorldObjectVisitor;
16  struct IDynamicWorldObjectConstVisitor;
17 
18  class PhysicsCore;
19  class MapEvent;
20 
22  , public IUpdateable
23  {
25 
26  public:
27 
28  virtual ~DynamicWorldObject ();
29 
30  virtual void Accept (IDynamicWorldObjectVisitor& visitor);
31  virtual void Accept (IDynamicWorldObjectConstVisitor& visitor) const;
32 
33  const ID& GetWorldID () const;
34  void SetWorldID (const ID& id);
35 
37  const ID& GetTypeID () const;
38 
39  const Vector2& GetMaxVelocity () const;
40  void SetMaxVelocity (const Vector2& maxVelocity);
41 
42  void SetPhysicsCore (PhysicsCore* physicsCore);
43  void ApplyForce (const Vector2& force);
44  const Vector2& GetMove () const;
45 
46  void RawSetVelocity (const Vector2& velocity);
47 
48  const String& GetState () const;
49  const String& GetLogicalState () const;
50  bool TryChangeState (const String& state);
51  void SetInactive ();
52 
56  void RawSetState (const String& state);
57 
58  bool IsActive () const;
59 
60  bool IsMoving () const;
61 
62  void AddTriggerBoundingBox (BoundingBox* boundingBox);
63 
64  void AddEvent (MapEvent* event);
65  void RemoveEvent (MapEvent* event);
66 
67  void GetEventsCollidingWith (
68  const CollidableArea& collidableArea,
69  MapEventQueue& events) const;
70 
73  virtual void Update (const Time& dt);
75 
79  Event<
82  Event<
86 
88 
89  protected:
90 
91  explicit DynamicWorldObject (const ID& id);
92 
94 
95  virtual const String& GetObjectFactoryTypeName () const = 0;
96 
97  virtual void HandleSetWorldID (const ID& worldID);
98  virtual void HandleSetCollidableArea (CollidableArea* collidableArea);
99 
100  virtual void HandleApplyForce (const Vector2& force);
101 
102  virtual void HandleUpdate (const Time& dt);
103  virtual void HandleSetState (const String& state);
104 
105  virtual void HandleMove (const Vector2& offset);
106  virtual void HandleScale (const Vector2& factor);
107  virtual void HandleSetZ (int z);
108  virtual void HandleSetH (int h);
109 
110  virtual void HandleOnVelocityChanged (
111  const Vector2& oldVelocity,
112  const Vector2& currentVelocity);
113 
114  private:
115 
116  void SetState (const String& state);
117 
119 
121 
123 
126 
128 
133  };
134 } // namespace yap
135 
136 #endif // YAPOG_DYNAMICWORLDOBJECT_HPP