void SetStartingCell(SimpleCityDungeonModel model, SimpleCityCell cell) { var cellSize = new Vector3(model.Config.CellSize.x, 0, model.Config.CellSize.y); var position = Vector3.Scale( new Vector3(cell.Position.x, cell.Position.y, cell.Position.z), cellSize); TeleportPlayerTo(position); }
void SetEndingCell(SimpleCityDungeonModel model, SimpleCityCell cell) { var cellSize = new Vector3(model.Config.CellSize.x, 0, model.Config.CellSize.y); var position = Vector3.Scale( new Vector3(cell.Position.x, cell.Position.y, cell.Position.z), cellSize); CreateLevelGoalAt(position); }
void ConnectAdjacentRoadTiles(SimpleCityDungeonModel model, SimpleCityCell cell, int dx, int dz, Dictionary <SimpleCityCell, Waypoint> cellToWaypoint, Dictionary <Waypoint, List <Waypoint> > adjacentWaypoints) { int adjacentX = cell.Position.x + dx; int adjacentZ = cell.Position.z + dz; if (adjacentX < 0 || adjacentZ < 0) { return; } var adjacentCell = model.Cells[adjacentX, adjacentZ]; if (cell.CellType == SimpleCityCellType.Road && adjacentCell.CellType == SimpleCityCellType.Road) { // Connect the two cells var waypoint1 = cellToWaypoint[cell]; var waypoint2 = cellToWaypoint[adjacentCell]; adjacentWaypoints[waypoint1].Add(waypoint2); adjacentWaypoints[waypoint2].Add(waypoint1); } }