Soldier.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // Created by jovian on 18/07/17.
  3. //
  4. #ifndef TINYSHOOTER_SOLDIER_H
  5. #define TINYSHOOTER_SOLDIER_H
  6. #include "Entity.h"
  7. #include "Bullet.h"
  8. #include "TinyWorld.h"
  9. #include "../Control/Controller.h"
  10. class Soldier : public Entity {
  11. public:
  12. Soldier(Faction faction, Controller *ctrl, TinyWorld* tinyWorld,
  13. unsigned int imgId, unsigned int camp, unsigned int life = 100);
  14. void shoot(const b2Vec2 &dir);
  15. virtual void update();
  16. void createPhysicalShape(b2Vec2 spawn = b2Vec2_zero);
  17. protected:
  18. Controller *m_ctrl; // Decision interface
  19. unsigned int m_camp; // 0 : ally, 1 : foe
  20. unsigned int m_life; // alive if above 0
  21. TinyWorld* m_tinyWorld; // Allows shooting (And allows AI to take decisions)
  22. b2Fixture* m_homeFixture; // Allows bullet determination in contacts
  23. // Movements
  24. float m_forceXScale;
  25. float m_forceYScale;
  26. b2Vec2 m_jumpVec;
  27. float m_jumpVelocityLimit;
  28. // Weapon
  29. unsigned int m_cool;
  30. const unsigned int m_coolCeil;
  31. };
  32. #endif //TINYSHOOTER_SOLDIER_H