Added logic to go from spectator to player.

This commit is contained in:
Jocke
2016-01-20 17:41:16 +01:00
parent 00588b07c5
commit cd67253173
5 changed files with 55 additions and 15 deletions
+11 -1
View File
@@ -35,7 +35,7 @@ void Client::Update()
{
m_EventBroker->Process<Client>();
readFromServer();
if (m_IsConnected) {
if (m_IsConnected) {
hasServerTimedOut();
}
}
@@ -271,6 +271,10 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
disconnect();
}
return true;
} else if (e.Command == "SwitchToPlayer") {
if (e.Value > 0) {
becomePlayer();
}
} else {
m_InputCommandBuffer.push_back(e);
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
@@ -334,6 +338,12 @@ void Client::sendInputCommands()
}
}
void Client::becomePlayer()
{
Packet packet = Packet(MessageType::BecomePlayer, m_SendPacketID);
send(packet);
}
bool Client::clientServerMapsHasEntity(EntityID clientEntityID)
{
return m_ClientIDToServerID.find(clientEntityID) != m_ClientIDToServerID.end();