/// <summary> /// Generates the level's walls and collision lines. /// </summary> /// <param name="isPreview">If true, then collision will not be calculated.</param> public void Generate(Vector2 wallOffset, bool isPreview) { Vector2 worldSize = new Vector2(LevelGen.Map.GetLength(0), LevelGen.Map.GetLength(1)); WorldConstants.Size = worldSize; CreateWalls walls = MakeWalls(wallOffset, LevelGen.Map, LevelGen.GenSettings.WrapX, LevelGen.GenSettings.WrapY); //Get the wall container. GameObject wallsContainer = WorldConstants.WallContainer; wallsToAnimate = new List <WallSheetData>(); //Create the wall objects. Creator.ChooseWallStyle(); if (!isPreview) { foreach (GameObject tempG in Creator.CreateWalls(LevelGen)) { wallsToAnimate.Add(tempG.GetComponent <WallSheetData>()); } } //Create the wall minimaps and collision. foreach (RecBounds b in walls.WallBounds) { WorldConstants.ColTracker.AddWall(b); Creator.CreateMinimapWall(b); } //Set up the mirrored wall collision and (if necessary) collision lines. if (!isPreview) { foreach (RecBounds b in walls.MirroredWallBounds) { Tracker.AddWall(b); } Tracker.Lines = walls.Lines; } }