2012-09-09 20:50:15 +00:00
|
|
|
/*
|
|
|
|
* Weapon.h
|
|
|
|
*
|
|
|
|
* Created on: 12.08.2012
|
|
|
|
* Author: Felix
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DG_WEAPON_H_
|
|
|
|
#define DG_WEAPON_H_
|
|
|
|
|
|
|
|
#include <Thor/Particles.hpp>
|
|
|
|
|
2012-10-04 17:10:12 +00:00
|
|
|
#include "../Instances.h"
|
2012-09-09 20:50:15 +00:00
|
|
|
#include "../abstract/Physical.h"
|
|
|
|
#include "../particle/Emitter.h"
|
2012-10-12 17:04:34 +00:00
|
|
|
#include "../util/Yaml.h"
|
2012-09-09 20:50:15 +00:00
|
|
|
|
2012-09-14 18:39:56 +00:00
|
|
|
class Emitter;
|
2012-10-04 17:10:12 +00:00
|
|
|
class Instances;
|
|
|
|
class Physical;
|
2012-10-12 17:22:53 +00:00
|
|
|
class Yaml;
|
2012-09-14 18:39:56 +00:00
|
|
|
|
2012-09-09 20:50:15 +00:00
|
|
|
/**
|
|
|
|
* Loading mechanism:
|
|
|
|
* - pass enum value and load mapped xml
|
|
|
|
* - pass xml filename
|
|
|
|
*/
|
2012-09-12 12:21:57 +00:00
|
|
|
class Weapon : public Emitter {
|
2012-09-11 19:13:36 +00:00
|
|
|
// Public functions.
|
2012-09-09 20:50:15 +00:00
|
|
|
public:
|
2012-10-12 17:04:34 +00:00
|
|
|
Weapon(const Instances& instances, Physical& holder, const Yaml& config);
|
2012-09-09 20:50:15 +00:00
|
|
|
|
|
|
|
void fire();
|
2012-09-12 12:21:57 +00:00
|
|
|
|
2012-09-11 19:13:36 +00:00
|
|
|
// Protected functions.
|
2012-09-09 20:50:15 +00:00
|
|
|
protected:
|
|
|
|
std::shared_ptr<Particle> createParticle();
|
|
|
|
|
2012-09-11 19:13:36 +00:00
|
|
|
// Private variables.
|
2012-09-09 20:50:15 +00:00
|
|
|
private:
|
2012-10-12 17:22:53 +00:00
|
|
|
static const String KEY_BULLET;
|
2012-09-11 19:15:16 +00:00
|
|
|
|
2012-09-09 20:50:15 +00:00
|
|
|
Physical& mHolder;
|
|
|
|
b2World& mWorld;
|
2012-10-12 17:04:34 +00:00
|
|
|
|
2012-10-13 10:48:16 +00:00
|
|
|
Vector2f mOffset; //< Offset to the point where bullets are inserted (from holder center).
|
2012-10-12 17:22:53 +00:00
|
|
|
const String mBullet;
|
2012-09-09 20:50:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* DG_WEAPON_H_ */
|