示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
            }
        }