public GameObject DrawDeadEnd(Coordinate coords, Direction direction) { float x = translator.translateToSceneRow(coords.x); float y = translator.translateToSceneColumn(coords.y); return(Instantiate(tiles.deadEndRoadTile, new Vector3(x, y, 0f), Quaternion.Euler(0, 0, (float)direction)) as GameObject); }
public GameObject DrawDeadEndSegment(PathNode[] nodes, PathNode node) { PathNode connectedNode = nodes[node.connectedNodes[0]]; Direction direction = RelativeDirection(node, connectedNode); float x = translator.translateToSceneRow(node.coords.x); float y = translator.translateToSceneColumn(node.coords.y); return(Instantiate(tiles.deadEndRoadTile, new Vector3(x, y, 0f), Quaternion.Euler(0, 0, (float)direction)) as GameObject); }
public void TranslateColumnTest() { var mapSettings = new Installer.Settings.MapSettings(); mapSettings.rows = 10; mapSettings.columns = 8; var boardTranslator = new BoardTranslator(mapSettings); Assert.AreEqual(2, boardTranslator.translateToSceneColumn(6)); Assert.AreEqual(-4, boardTranslator.translateToSceneColumn(0)); }
public GameObject[] SetupDecorations(LevelDecor[] decorations) { GameObject[] decorationObjects = new GameObject[decorations.Length]; for (int currentIndex = 0; currentIndex < decorations.Length; currentIndex++) { LevelDecor decoration = decorations[currentIndex]; GameObject tile; Dictionary <String, GameObject> nameToTile = new Dictionary <String, GameObject>(); nameToTile.Add("tree1", tiles.tree1Tile); nameToTile.Add("tree2", tiles.tree2Tile); nameToTile.Add("bush", tiles.bushTile); nameToTile.Add("pond", tiles.pondTile); tile = null; if (nameToTile.TryGetValue(decoration.decorName, out tile)) { float row = translator.translateToSceneRow(decoration.x / 100f, false); float column = translator.translateToSceneColumn(decoration.y / 100f, false); decorationObjects[currentIndex] = Instantiate(tile, new Vector3(row, column, 0f), Quaternion.identity) as GameObject; } else { decorationObjects[currentIndex] = new GameObject(); } } return(decorationObjects); }
private void SetupBoard() { for (int x = 0; x < columns; x++) { for (int y = 0; y < rows; y++) { SetStaticWithBoardAsParent( Instantiate(floorTiles.grassTile, new Vector3(translator.translateToSceneRow(x, true), translator.translateToSceneColumn(y, true), 0f), Quaternion.identity) as GameObject); } } }