AmmoPickups and HealthPickups will only spawn on the server. When a ammo pickup is taken the Server will send an Event to that

Client and it will update its ammo.
This commit is contained in:
Jocke
2016-03-01 17:55:00 +01:00
parent 6d68486c05
commit aadfdfdd90
8 changed files with 124 additions and 57 deletions
+11
View File
@@ -143,6 +143,9 @@ void Client::parseMessageType(Packet& packet)
case MessageType::OnDoubleJump:
parseDoubleJump(packet);
break;
case MessageType::AmmoPickup:
parseAmmoPickup(packet);
break;
default:
break;
}
@@ -294,6 +297,14 @@ void Client::parseDoubleJump(Packet & packet)
}
}
void Client::parseAmmoPickup(Packet & packet)
{
Events::AmmoPickup e;
e.AmmoGain = packet.ReadPrimitive<int>();
e.Player = m_LocalPlayer;
m_EventBroker->Publish(e);
}
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
{
for (auto field : componentInfo.FieldsInOrder) {