16 m_attachmentIt = m_attachments.begin();
17 for (; m_attachmentIt != m_attachments.end(); m_attachmentIt++)
20 pAttachment->
Update(gameTime);
28 if (m_isInvulnurable)
return;
30 m_hitPoints -= damage;
31 if (m_hitPoints > 0)
return;
39 m_attachmentIt = m_attachments.find(key);
40 if (m_attachmentIt == m_attachments.end())
return nullptr;
41 return m_attachmentIt->second;
46 if (index < m_attachments.size())
48 m_attachmentIt = m_attachments.begin();
49 std::advance(m_attachmentIt, index);
50 return m_attachmentIt->second;
58 m_hitPoints = m_maxHitPoints;
69 m_attachmentIt = m_attachments.begin();
70 for (; m_attachmentIt != m_attachments.end(); m_attachmentIt++)
72 if (m_attachmentIt->second->GetAttachmentType() !=
"Weapon")
continue;
73 ((
Weapon *)(m_attachmentIt->second))->Fire(triggerType);
86 m_attachments[item->
GetKey()] = item;
virtual void SetPosition(const float x, const float y)
virtual void SetCollisionRadius(const int radius)
virtual void Deactivate()
Deactivate the object.
static Level * GetCurrentLevel()
Get the current level.
virtual void Update(const GameTime &gameTime)
Update the object.
Contains timing values for game updates and rendering.
Interface for a particle emitter.
virtual std::string GetKey() const =0
virtual void Update(const GameTime &gameTime)=0
virtual void AttachTo(IAttachable *pAttachable, Vector2 &position)=0
Defines a vector with 2 components (x and y).
virtual void SpawnExplosion(GameObject *pExplodingObject)
Spawn an explosion at a specific position.
virtual IAttachment * GetAttachment(const std::string &key)
virtual void Update(const GameTime &gameTime)
Updates the ship.
virtual void Hit(const float damage)
Applies damage to the ship.
virtual void Initialize()
Initializes the ship.
Ship()
Creates a new instance of Ship.
virtual void AttachItem(IAttachment *item, Vector2 position)
Attaches a weapon to the ship.
virtual void FireWeapons(TriggerType type=TriggerType::All)
Fires the ship's weapons.
Represents a type of trigger, which can be used to activate weapons.
Base class for all weapons that can be fired by a game object.