feat: add basic towers rendering

This commit is contained in:
2021-09-26 18:19:00 +02:00
parent 2ece5bc9b5
commit fe7cfdec72
22 changed files with 230 additions and 58 deletions

View File

@@ -3,13 +3,14 @@
#include "game/client/ClientGame.h"
#include "render/WorldRenderer.h"
#include <iostream>
namespace td {
namespace client {
WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::PacketHandler(game->GetDispatcher()), m_Game(game) {
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldBeginData, this);
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldData, this);
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldAddTower, this);
GetDispatcher()->RegisterHandler(protocol::PacketType::SpawnMob, this);
}
@@ -21,10 +22,6 @@ void WorldClient::HandlePacket(protocol::WorldDataPacket* packet) {
loadMap(packet);
}
void WorldClient::HandlePacket(protocol::WorldAddTowerPacket* packet) {
placeTowerAt(packet->getTowerType(), packet->getTowerX(), packet->getTowerY(), packet->getBuilder());
}
void WorldClient::HandlePacket(protocol::SpawnMobPacket* packet) {
spawnMobAt(packet->getMobID(), packet->getMobType(), packet->getMobLevel(), packet->getSender(),
packet->getMobX(), packet->getMobY(), packet->getMobDirection());