This repository has been archived on 2019-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
dungeon-gunner/source/items/Weapon.h

50 lines
1 KiB
C
Raw Normal View History

/*
* Weapon.h
*
* Created on: 12.08.2012
* Author: Felix
*/
#ifndef DG_WEAPON_H_
#define DG_WEAPON_H_
2013-03-29 17:34:51 +00:00
#include <string>
#include <SFML/System.hpp>
#include "../particle/Emitter.h"
2013-05-26 18:44:59 +00:00
class Character;
class World;
class Particle;
2013-05-26 18:44:59 +00:00
class Yaml;
/**
* Loading mechanism:
* - pass enum value and load mapped xml
* - pass xml filename
*/
class Weapon : public Emitter {
public:
2013-05-26 18:44:59 +00:00
explicit Weapon(World& world, Character& holder, const Yaml& config);
2012-12-24 00:14:22 +00:00
void pullTrigger();
void releaseTrigger();
2013-03-09 15:25:04 +00:00
void onThink(int elapsed);
protected:
2013-03-29 17:34:51 +00:00
std::shared_ptr<Sprite> createParticle();
private:
2013-05-26 18:44:59 +00:00
Character& mHolder;
2013-03-09 15:25:04 +00:00
const std::string mBullet; //< Bullet config filename.
int mLastShotWaitInterval; //< Remaining time left after firing last bullet before firing next one.
const int mFireInterval; //< Time between firing bullets.
bool mFire; //< True if the trigger is pulled.
bool mAutomatic; //< True if the weapon continues firing after pulling the trigger once.
};
#endif /* DG_WEAPON_H_ */