Soldier.h 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_forceScale;
  25. b2Vec2 m_jumpVec;
  26. float m_jumpVelocityLimit;
  27. // Weapon
  28. unsigned int m_cool;
  29. const unsigned int m_coolCeil;
  30. };
  31. #endif //TINYSHOOTER_SOLDIER_H