public static void Process() { if (!prefabsToSpawn.IsEmpty) { SpawnSafeThreadData data; while (prefabsToSpawn.TryDequeue(out data)) { var result = Spawn.ServerPrefab(data.Prefab, data.WorldPosition, data.ParentTransform == null ? MatrixManager.GetDefaultParent(data.WorldPosition, true) : data.ParentTransform, count: data.Amount); //Greater than one as most items start stacked at 1 if (result.Successful && data.AmountIfStackable > 1 && result.GameObject.TryGetComponent <Stackable>(out var stackable)) { // -1 as we are adding, eg if we want 10 in stack, item already starts at 1 so we add 9 stackable.ServerIncrease(data.AmountIfStackable - 1); } } } if (!tilesToUpdate.IsEmpty) { Tuple <uint, Vector3Int, TileType, string, Matrix4x4, Color, LayerType> tuple; while (tilesToUpdate.TryDequeue(out tuple)) { UpdateTileMessage.Send(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7); } } if (!tilesToRemove.IsEmpty) { Tuple <uint, Vector3Int, LayerType> tuple; while (tilesToRemove.TryDequeue(out tuple)) { RemoveTileMessage.Send(tuple.Item1, tuple.Item2, tuple.Item3); } } }
public static void Process() { if (!prefabsToSpawn.IsEmpty) { Tuple <Vector3, GameObject> tuple; while (prefabsToSpawn.TryDequeue(out tuple)) { Spawn.ServerPrefab(tuple.Item2, tuple.Item1, MatrixManager.GetDefaultParent(tuple.Item1, true)); } } if (!tilesToUpdate.IsEmpty) { Tuple <uint, Vector3Int, TileType, string, Matrix4x4, Color> tuple; while (tilesToUpdate.TryDequeue(out tuple)) { UpdateTileMessage.Send(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6); } } }