public override void ProcessPacket(TrashSystemNewTrashCreatedPacket packet, NebulaConnection conn) { bool valid = true; if (IsHost) { Player player = playerManager.GetPlayer(conn); if (player != null) { playerManager.SendPacketToOtherPlayers(packet, player); } else { valid = false; } } if (valid) { int myId = SimulatedWorld.GenerateTrashOnPlayer(packet); //Check if myID is same as the ID from the host if (myId != packet.TrashId) { TrashManager.SwitchTrashWithIds(myId, packet.TrashId); } } }
public void ProcessPacket(TrashSystemCorrectionIdPacket packet, NebulaConnection conn) { if (packet.OriginalId != packet.NewId) { //Server sent correction packet for the trashId //Switch item on position NewId, with item on position OriginalId TrashManager.SwitchTrashWithIds(packet.OriginalId, packet.NewId); } }
public void ProcessPacket(TrashSystemNewTrashCreatedPacket packet, NebulaConnection conn) { int myId = SimulatedWorld.GenerateTrashOnPlayer(packet); //Check if myID is same as the ID from the host if (myId != packet.TrashId) { TrashManager.SwitchTrashWithIds(myId, packet.TrashId); } }