public void BeginPlay() { intensityRand = new System.Random(MazeGenerator.Seed); hueRand = new System.Random(MazeGenerator.Seed); rand = new System.Random(MazeGenerator.Seed); messageRand = new System.Random(MazeGenerator.Seed); if (!TutorialOn) { Maze = new GameObject("Maze"); Maze.transform.parent = GameParent.transform; } Sections = new List <MazeSection>(); // Start new Session in Analytics // Generate Level // Add Level to Analytics // Add Sections to Analytics // Add Cells to Analytics Dictionary <int, MazeNode[, ]> storedDifficultyMaps = storedMaps[(int)difficulty]; //print(storedDifficultyMaps); if (storedDifficultyMaps.ContainsKey(MazeGenerator.Seed)) { MazeGenerator.DifferentSections = storedMaps[(int)difficulty][MazeGenerator.Seed]; MazeGenerator.connectLadderNodes(difficulty, MazeGenerator.DifferentSections); } else { MazeGenerator.GenerateMaze(difficulty); storedMaps[(int)difficulty].Add(MazeGenerator.Seed, MazeGenerator.DifferentSections); } //print("Something"); if (TutorialOn) { tutorial4[1, 5].AddLadderTo(MazeGenerator.DifferentSections[0, 0]); } lvlID = AnalyticsManager.AddLevel(MazeGenerator.Seed, (int)difficulty); SessionID = AnalyticsManager.AddSession(lvlID, (int)PlayersVRType); int[,] sectionIDs = new int[5, 8]; MazeNode[,] roots = MazeGenerator.DifferentSections; List <MazeNode> nodes; for (int i = 0; i < 5; i++) { for (int j = 0; j < 8; j++) { if (roots[i, j] != null) { MazeSection section = new MazeSection(); section.Root = roots[i, j]; sectionIDs[i, j] = AnalyticsManager.AddSection(lvlID, i, j); section.SectionID = sectionIDs[i, j]; section.Spawned = false; foreach (MazeNode n in MazeGenerator.nodesInSection(roots[i, j])) { n.SectionID = section.SectionID; } Sections.Add(section); } } } // Spawn first section foreach (MazeSection s in Sections) { if (s.Root.Col == 0 && s.Root.Row == 0 && s.Root.Floor == 0) { if (!TutorialOn) { SpawnSection(s); } } } // Spawn Player if (!TutorialOn) { Vector3 location = new Vector3(8, 1, 8); PlayerObj = Instantiate(Resources.Load(PlayerTypeLoc), location, roots[0, 0].GetRotation()) as GameObject; PlayerObj.AddComponent <Actor>().ActorID = AnalyticsManager.AddActor(SessionID, ActorType.Player); PlayerObj.transform.parent = GameParent.transform; } }