#ifndef HOLESOME_PLAYER_COLLECTION_HPP #define HOLESOME_PLAYER_COLLECTION_HPP #include "../game_object.h" #include "player.hpp" class PlayerCollection : public GameObject { public: PlayerCollection(); static std::shared_ptr getInstance(); void setSpawnPoints(std::vector newSpawnPoints); void addPlayer(const std::shared_ptr& player); void removePlayer(const std::shared_ptr& player); [[nodiscard]] std::vector> getPlayers() const; [[nodiscard]] std::shared_ptr getPlayerById(int playerId) const; [[nodiscard]] std::vector> getNewPlayers() const; [[nodiscard]] std::vector> getRemovedPlayers() const; void lateUpdate() override; void clear(); private: static inline std::shared_ptr singletonInstance = nullptr; std::vector> newPlayerBuffer = {}; std::vector> removedPlayerBuffer = {}; std::vector spawnPoints; int nextSpawnPointIndex = 0; void spawnPlayer(const std::shared_ptr &inputIdentity); }; #endif //HOLESOME_PLAYER_COLLECTION_HPP