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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user