00001 #ifndef _BREAKOUTBOX_H_ 00002 #define _BREAKOUTBOX_H_ 00003 00004 #include "Vector2.h" 00005 #include "AABB.h" 00006 00007 class BreakoutBox 00008 { 00009 public: 00010 BreakoutBox(); 00011 BreakoutBox(const Vector2i &pos, const Vector2i &size, const unsigned int &health); 00012 ~BreakoutBox(); 00013 00014 virtual void Draw(); 00015 virtual void Update() {} 00016 00017 void SetPosition(const Vector2i &pos) 00018 { 00019 m_position = pos; 00020 updateBBox(); 00021 } 00022 00023 void SetSize(const Vector2i &size) 00024 { 00025 m_size = size; 00026 updateBBox(); 00027 } 00028 00029 void SetHealth(const int &health) { m_health = health; } 00030 00031 void Enable() { m_bIsEnabled = true; } 00032 bool IsEnabled() { return m_bIsEnabled; } 00033 void Disable() { m_bIsEnabled = false; } 00034 00035 Vector2i GetPosition() { return m_position; } 00036 Vector2i GetSize() { return m_size; } 00037 00038 AABBi GetAABB() { return m_boundingBox; } 00039 00040 void TakeHit(); 00041 00042 int GetHealth() { return m_health; } 00043 00044 bool IsAlive() { return m_bIsAlive; } 00045 00046 protected: 00047 bool m_bIsEnabled, m_bIsAlive; 00048 Vector2i m_position, m_size; 00049 AABBi m_boundingBox; 00050 int m_health; 00051 unsigned long m_lastHitTime; 00052 00053 void updateBBox(); 00054 }; 00055 00056 #endif
1.5.9