public static Room Generate(RoomSettings settings) { RoomGenerator.settings = settings; room = new Room(settings.width, settings.height); prng = new System.Random(settings.seed); openCoords = new FisherYates.ShuffleList <Coord>(room.tileCount, prng); // fill coord array and initialize room with empty tiles for (int x = 0; x < settings.width; x++) { for (int y = 0; y < settings.height; y++) { Coord c = new Coord(x, y); InstantiateEmpty(c); openCoords.Add(c); } } // place doors // place obstacles PlaceRandomObstacles(); return(room); }
public static Room Generate(RoomSettings settings) { RoomGenerator.settings = settings; room = new Room(settings); prng = new System.Random(settings.seed); openCoords = new FisherYates.ShuffleList <Coord>(room.tileCount, prng); // fill coord array and initialize room with empty tiles for (int x = 0; x < settings.width; x++) { for (int y = 0; y < settings.height; y++) { Coord c = new Coord(x, y); InsertEmpty(c); openCoords.Add(c); } } // place Warps foreach (RoomSettings.WarpSettings warp in settings.warps) { InsertWarp(warp.position, warp.target); } PlaceRandomObstacles(); PlaceEnemySpawnPoints(); return(room); }
public Room(int width, int height) { size = new Coord(width, height); tileCount = width * height; center = new Coord(width / 2, height / 2); tiles = new ITile[width, height]; openTiles = new FisherYates.ShuffleList <Coord>(tileCount); }
public void SetSpawnPoints(Transform[] points) { if (points.Length > 0) { spawnPoints = new FisherYates.ShuffleList <Transform>(points); } else { spawnPoints = null; } }
public Room(RoomSettings settings) { this.settings = settings; var width = settings.width; var height = settings.height; size = new Coord(width, height); tileCount = width * height; center = new Coord(width / 2, height / 2); tiles = new ITile[width, height]; enemySpawnPoints = new bool[width, height]; openTiles = new FisherYates.ShuffleList <Coord>(tileCount); }
void Awake() { projectileRadius = subBossProjectilePrefab.GetComponent <SphereCollider>().radius; gravity = Physics.gravity.magnitude; spawnPoints = new FisherYates.ShuffleList <Vector3>( spawnPointTransforms.Length); foreach (Transform point in spawnPointTransforms) { spawnPoints.Add(point.position); } SubBossController.DyingStatic -= SubBossDyingHandler; SubBossController.DyingStatic += SubBossDyingHandler; }