public void QueueCommand(ComEntityCommand command) { TwitchUserComEntityData.CommandQueue.Enqueue(command); if (!coHostCommands.Running) { coHostCommands.Start(DoCommandQueue(TwitchUserComEntityData.CommandQueue)); } }
public TileMap() { var startIndex = Tuple.Create <int, int>(FP.Rand(MapWidth), FP.Rand(MapHeight)); var endIndex = Tuple.Create <int, int>(FP.Rand(MapWidth), FP.Rand(MapHeight)); while (startIndex.Item1 == endIndex.Item1 && startIndex.Item1 == endIndex.Item2) { endIndex = Tuple.Create <int, int>(FP.Rand(MapWidth), FP.Rand(MapHeight)); } for (int y = 0; y < MapHeight; y++) { int rowOffset = (y % 2 == 1) ? OddRowXOffset : 0; MapRow row = new MapRow(); for (int x = 0; x < MapWidth; x++) { TileType tileType; if (x == startIndex.Item1 && y == startIndex.Item2) { tileType = TileType.Start; } else if (x == endIndex.Item1 && y == endIndex.Item2) { tileType = TileType.End; } else { tileType = FP.Choose.EnumWeighted <TileType>(0, 0, 0, 1, .65f, 0); } MapCell mc = new MapCell(tileType, TileSize, Tuple.Create <int, int>(x, y)) { X = x * TileStepX + rowOffset, Y = y * TileStepY }; mc.SetPathNode(new PathNode(mc, null, mc.X, mc.Y)); this.AddComponent <Image>(mc); row.Columns.Add(mc); } Rows.Add(row); } //CoroutineHost coHost1 = AddComponent<CoroutineHost>(new CoroutineHost()); //coHost1.Start(RunBuildNodeConnections()); foreach (MapRow mr in Rows) { foreach (MapCell mc in mr.Columns) { PathNode.ConnectedNodes[mc.MyNode] = SelectTilesAroundTile(mc.Index.Item1, mc.Index.Item2); } } CoroutineHost coHost2 = AddComponent <CoroutineHost>(new CoroutineHost()); coHost2.Start(RunBuildPath(startIndex, endIndex)); }
public TileMap() { var startIndex = Tuple.Create <int, int>(FP.Rand(MapWidth), FP.Rand(MapHeight)); var endIndex = Tuple.Create <int, int>(FP.Rand(MapWidth), FP.Rand(MapHeight)); while (startIndex.Item1 == endIndex.Item1 && startIndex.Item1 == endIndex.Item2) { endIndex = Tuple.Create <int, int>(FP.Rand(MapWidth), FP.Rand(MapHeight)); } for (int y = 0; y < MapHeight; y++) { MapRow row = new MapRow(); for (int x = 0; x < MapWidth; x++) { TileType tileType; if (x == startIndex.Item1 && y == startIndex.Item2) { tileType = TileType.Start; } else if (x == endIndex.Item1 && y == endIndex.Item2) { tileType = TileType.End; } else { tileType = FP.Choose.EnumWeighted <TileType>(0, 0, 0, 1, .65); } MapCell mc = new MapCell(tileType, TileSize, Tuple.Create <int, int>(x, y)) { X = x * TileSize, Y = y * TileSize }; mc.SetPathNode(new PathNode(mc, null, x, y)); this.AddComponent <Image>(mc); row.Columns.Add(mc); } Rows.Add(row); } foreach (MapRow mr in Rows) { foreach (MapCell mc in mr.Columns) { PathNode.ConnectedNodes[mc.MyNode] = SelectTilesAroundTile(mc.Index.Item1, mc.Index.Item2); } } CoroutineHost coHost = AddComponent <CoroutineHost>(new CoroutineHost()); coHost.Start(Things(startIndex, endIndex)); }