player.h 626 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef INCLUDEPLAYER_H
  2. #define INCLUDEPLAYER_H
  3. #include "units/unit.h"
  4. #include <QObject>
  5. #include <set>
  6. class Race;
  7. template<class Obj, class Identifier>
  8. class ObjectFactory;
  9. template<int id>
  10. class Player {
  11. private:
  12. Player() {
  13. }
  14. public:
  15. static Player& getInstance() {
  16. static Player<id> instance;
  17. return instance;
  18. }
  19. void init() {
  20. player_name_ = "Игрок " + QString::number(id);
  21. race_ = nullptr;
  22. units_.clear();
  23. }
  24. signals:
  25. public slots:
  26. private:
  27. QString player_name_;
  28. std::set<Unit> units_;
  29. Race* race_;
  30. };
  31. #endif // INCLUDEPLAYER_H