21 m_isAttachedToPlayer = isAttachedToPlayer;
22 m_isActive = isActive;
58 virtual void SetProjectilePool(std::vector<Projectile *> *pProjectiles) { m_pProjectiles = pProjectiles; }
86 m_pGameObject =
dynamic_cast<GameObject*
>(pAttachable);
91 virtual std::string
GetKey()
const {
return m_key; }
111 m_projectileIt = m_pProjectiles->begin();
112 for (; m_projectileIt != m_pProjectiles->end(); m_projectileIt++)
115 if (!pProjectile->
IsActive())
return pProjectile;
124 bool m_isActive =
true;
125 bool m_isAttachedToPlayer =
true;
135 std::vector<Projectile *>::iterator m_projectileIt;
136 std::vector<Projectile *> *m_pProjectiles;
Represents a game object in the game. This is the base class for all objects that can be updated,...
virtual bool IsActive() const
Flag to determine if the object is active.
virtual Vector2 & GetPosition()
Get the position of the object.
Represents a 2D grid of texels.
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 projectile that can be fired by a weapon.
Represents a type of trigger, which can be used to activate weapons.
static const TriggerType Primary
Base class for all weapons that can be fired by a game object.
virtual void AttachTo(IAttachable *pAttachable, Vector2 &position)
Attach the weapon to a game object.
Weapon(const std::string &key, bool isAttachedToPlayer=true, bool isActive=true, TriggerType triggerType=TriggerType::Primary)
Instantiate a weapon object.
virtual void Draw(SpriteBatch &spriteBatch)
Render the weapon.
virtual std::string GetAttachmentType() const
virtual void Dectivate()
Deactivate the weapon.
virtual bool IsAttachedToPlayer() const
Determine if the weapon is attached to the player.
virtual void Activate()
Activate the weapon.
virtual void SetProjectilePool(std::vector< Projectile * > *pProjectiles)
Set the pool of projectiles that the weapon can fire.
virtual TriggerType GetTriggerType() const
Get the game object that the weapon is attached to.
virtual void Update(const GameTime &gameTime)
Update the weapon.
virtual AudioSample * GetFireSound()
Get the sound that will be played when the weapon is fired.
virtual std::string GetKey() const
virtual Vector2 GetPosition() const
Get the screen position of the weapon.
virtual void SetFireSound(AudioSample *pSound)
Set the sound that will be played when the weapon is fired.
virtual Projectile * GetProjectile()
Get a projectile from the pool.
virtual bool IsActive() const
Determine if the weapon is active.
virtual void Fire(TriggerType triggerType)=0
Attempt to fire the weapon.
virtual void SetTriggerType(TriggerType triggerType)
Set the game object that the weapon is attached to.
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...