// // Created by Иван Ильин on 25.05.2021. // #ifndef SHOOTER_CLIENT_H #define SHOOTER_CLIENT_H #include "network/ClientUDP.h" #include "Player.h" class Client : public ClientUDP { private: std::map> _players{}; std::shared_ptr _player; void spawnPlayer(sf::Uint16 id); std::function _spawnPlayerCallBack; std::function _removePlayerCallBack; std::function _addFireTraceCallBack; std::function _addBonusCallBack; std::function _removeBonusCallBack; public: explicit Client(std::shared_ptr player) : _player(player){}; void updatePacket() override; void setSpawnPlayerCallBack(std::function spawn); void setRemovePlayerCallBack(std::function remove); void setAddFireTraceCallBack(std::function addTrace); void setAddBonusCallBack(std::function addBonus); void setRemoveBonusCallBack(std::function removeBonus); void processInit(sf::Packet& packet) override; void processUpdate(sf::Packet& packet) override; void processNewClient(sf::Packet& packet) override; void processDisconnect(sf::Uint16 targetId) override; void processCustomPacket(MsgType type, sf::Packet& packet) override; void processDisconnected() override; void damagePlayer(sf::Uint16 targetId, double damage); void takeBonus(const std::string& bonusName); void addTrace(const Point4D& from, const Point4D& to); void addPlayer(sf::Uint16 id, std::shared_ptr player); }; #endif //MINECRAFT_3DZAVR_CLIENT_H