private static IEnumerator WaitAndAddChunk(Vector3 chunk) { yield return(new WaitForSeconds(0.5f)); Int3 owningChunk = new Int3((int)chunk.x, (int)chunk.y, (int)chunk.z); loadedChunks.AddChunk(owningChunk); chunkAwarePacketReceiver.ChunkLoaded(owningChunk); }
private IEnumerator WaitAndAddChunk(Int3 batchId, int level) { yield return(new WaitForSeconds(0.5f)); Chunk chunk = new Chunk(batchId, level); if (!loadedChunks.Contains(chunk)) { loadedChunks.Add(chunk); added.Add(chunk); chunkAwarePacketReceiver.ChunkLoaded(chunk); } }
public void PacketPrioritizedAfterBeingDeferred() { Packet packet1 = new TestActionPacket(playerId, unloadedActionPosition); packetReceiver.PacketReceived(packet1); Assert.AreEqual(0, packetReceiver.GetReceivedPackets().Count); Packet packet2 = new TestNonActionPacket(playerId); packetReceiver.PacketReceived(packet2); loadedChunks.Add(unloadedChunk); packetReceiver.ChunkLoaded(unloadedChunk); Queue <Packet> packets = packetReceiver.GetReceivedPackets(); Assert.AreEqual(2, packets.Count); Assert.AreEqual(packet1, packets.Dequeue()); Assert.AreEqual(packet2, packets.Dequeue()); }