27 virtual void Hit(
const float damage);
35 virtual void SetInvulnurable(
bool isInvulnurable =
true) { m_isInvulnurable = isInvulnurable; }
39 virtual std::string
ToString()
const {
return "Ship"; }
55 virtual float GetSpeed()
const {
return m_speed; }
59 virtual void SetSpeed(
const float speed) { m_speed = speed; }
63 virtual void SetMaxHitPoints(
const float hitPoints) { m_maxHitPoints = hitPoints; }
85 if (m_attachments.find(key) == m_attachments.end())
return nullptr;
86 return dynamic_cast<Weapon *
>(m_attachments[key]);
102 float m_maxHitPoints = 3;
103 float m_hitPoints = m_maxHitPoints;
105 bool m_isInvulnurable =
false;
110 std::map<std::string, IAttachment *> m_attachments;
111 std::map<std::string, IAttachment *>::iterator m_attachmentIt;
Represents a type of collision.
Represents a game object in the game. This is the base class for all objects that can be updated,...
Contains timing values for game updates and rendering.
Interface for an object that can have items attached to it.
Interface for a particle emitter.
Enables a group of sprites to be drawn using the same settings.
Defines a vector with 2 components (x and y).
Represents a ship in the game.
virtual IAttachment * GetAttachment(const std::string &key)
virtual void Draw(SpriteBatch &spriteBatch)=0
Draws the ship.
virtual void Update(const GameTime &gameTime)
Updates the ship.
virtual float GetHitPoints() const
Gets the current hit points of the ship.
virtual void SetSpeed(const float speed)
Sets the speed of the ship.
virtual void Hit(const float damage)
Applies damage to the ship.
virtual void SetMaxHitPoints(const float hitPoints)
Sets the max hit points of the ship.
virtual bool IsInvulnurable() const
To determine if the ship should take damage when hit.
virtual float GetMaxHitPoints() const
Gets the max hit points of the ship.
virtual void Initialize()
Initializes the ship.
virtual CollisionType GetCollisionType() const =0
Gets the collision type of the ship.
Ship()
Creates a new instance of Ship.
virtual void AttachItem(IAttachment *item, Vector2 position)
Attaches a weapon to the ship.
virtual void SetInvulnurable(bool isInvulnurable=true)
Sets the invulnerability of the ship.
virtual std::string ToString() const
Gets the string representation of the ship.
virtual void FireWeapons(TriggerType type=TriggerType::All)
Fires the ship's weapons.
virtual Weapon * GetWeapon(const std::string &key)
Gets a weapon from the ship's weapon list.
virtual float GetSpeed() const
Gets the speed of the ship.
Represents a type of trigger, which can be used to activate weapons.
static const TriggerType All
Base class for all weapons that can be fired by a game object.