public void StartGame() { numGems = gemsContainer.childCount; numHumans = humansController.humans.Length; gameHUD.Init(numHumans, numGems); humansController.enabled = true; cameraController.setGameCamera(); if (firstRun) { menuManager.StartGame(); } else { menuManager.StartGameDirectly(); } firstRun = false; }
public void InitScene() { IsDisposed = false; GameEnded = false; gameHUD = new GameHUD(gl); gameHUD.Init(); SceneManager.HUD = gameHUD; // Create scene's background CreateBackground(); // Create player PlayerObject player = new PlayerObject(new Vector2(34, 71), "Player", new Vector2(SceneManager.ScreenSize.X / 2f, 5)); player.Animator.AddTexture("HOOK", new Bitmap("./Textures/HOOK.png")); player.Animator.CurrentTexture = "HOOK"; SceneManager.AddObject(player); SceneManager.Player = player; // Create fishes Fish.RegisterTextures(); Fish3.RegisterTextures(); new Thread(new ThreadStart(CreateFishes)).Start(); // Create bombs Bombs.RegisterTextures(); new Thread(new ThreadStart(CreateBombs)).Start(); // Create bubbles float bubblePos = 500; while (bubblePos < 17000) { CreateBubbles(new Vector2((float)this.random.NextDouble() * SceneManager.ScreenSize.X, bubblePos, SceneManager.ScreenSize.X, 0)); bubblePos += 50 + (float)this.random.NextDouble() * 475; } // Create player's aim GameObject aim = new GameObject(new Vector2(40, 40), "Aim"); aim.Animator.AddTexture("AIM", AIM_TEXTURE_ID); aim.Animator.CurrentTexture = "AIM"; aim.Transform.SetPositionFn(() => { aim.Transform.Position = SceneManager.MousePositionInScene() - aim.Transform.Size / 2f; }); SceneManager.Aim = aim; // Play games' song long position; try { position = OutputDevice.GetPosition(); } catch { position = 0; } if (position == 0) { keepPlaying = true; OutputDevice.PlaybackStopped += SongStopped; OutputDevice.Init(audioFile); OutputDevice.Play(); } }