// Start is called before the first frame update void Start() { instance = this; hackableObjects = new List <Hackable>(); terminals = new List <Terminal>(); tutorialInfo = FindObjectOfType <TutorialInfo>(); grid = FindObjectOfType <DungeonGrid>(); if (tutorialInfo) { generator = new GridGenerator(1, 0); } else { generator = TryMakeDungeonUntilSuccessful(); } int[][] gridPlan = generator.GetGrid(); SetUpCamera(gridPlan.Length); grid.GenerateGrid(gridPlan); grid.GenerateSwitchTilesOn(generator.GetSwitchTilesOn()); grid.GenerateSwitchTilesOff(generator.GetSwitchTilesOff()); grid.GenerateRamps(generator.GetRamps()); grid.GenerateFirewalls(generator.GetFirewalls()); grid.GenerateDefenses(generator.GetDefences()); grid.GenerateTerminals(generator.GetTerminals()); grid.GenerateSwitches(generator.GetSwitches()); grid.GenerateSecurityHubs(generator.GetHubs()); if (tutorialInfo) { AssignEnemyTypes(ref generator, tutorialInfo.GetEnemies()); } foreach (Room room in generator.rooms) { List <EnemyProgram> enemiesInRoom = grid.GenerateEnemies(room.GetEnemies()); grid.AssignPatrolRoutes(ref enemiesInRoom, room.patrolRoutes); } grid.GeneratePorts(generator.GetPorts()); grid.AssignTerminalControl(generator.GetTerminalControlledObjects()); foreach (Room room in generator.rooms) { if (room.isControlledByInternalTerminal) { room.ConnectTerminal(ref terminals); } room.ConnectSwitches(); } RemoveUnusedTerminals(); grid.PlaceLoot(generator.GetLoot()); grid.PlaceObjective(generator.getMissionObj()); if (tutorialInfo) { CreatePlayerPrograms(tutorialInfo.tutorialPrograms); } else { CreatePlayerPrograms(MissionStatus.instance.selectedPrograms); } grid.CreateDeploymentZone(generator.GetDeploymentArea()); FindObjectOfType <CameraContol>().Configure(); grid.ExploreStartingArea(generator.GetDeploymentArea()); PrepareNextDeployment(); }