public void StartLevel() { if (this.CurrentlyLevel > 0) { this.StartSound(); } if (this.SceneUI == null) { this.SceneUI = new Hud(); this.SceneUI.World = this.WorldUIMainMenu; this.SceneUI.GameManager = this; this.SceneUI.Start(this.Content, this.Mouse, this.Screem); } this.SceneLevel = this.Levels[this.CurrentlyLevel]; this.SceneLevel.Screem = this.Screem; this.SceneLevel.Storage = this.Storage; this.SceneLevel.FontBold = this.FontBold; this.SceneLevel.Start(Content, World, Mouse); this.SceneUI.SetLevel(this.SceneLevel); this.SaveProgress(this.CurrentlyLevel); }
public GameManager(ContentManager Content, ScreemController ScreemController, UmbrellaToolKit.Storage.Load Storage, Game1 Game) { this.Storage = Storage; CurrentlyLevel = 0; this.Content = Content; this.Screem = ScreemController; this.Game = Game; this.FontBold = Content.Load <SpriteFont>("Fonts/Quicksand-Bold"); this.FontRegular = Content.Load <SpriteFont>("Fonts/Quicksand-Regular"); this.Localization = Content.Load <LocalizationDefinitions>("Languages"); this.World = new World(); this.World.Gravity = new Vector2(0, 10); this.MusicSoundTrack = Content.Load <SoundEffect>("Sound/kalimba-relaxation-music-by-kevin-macleod-from-filmmusic-io"); this.soundInstance = this.MusicSoundTrack.CreateInstance(); this.soundInstance.Volume = 0.1f; this.soundInstance.IsLooped = true; this.Mouse = new MouseManager(); this.MouseWhite = Content.Load <Texture2D>("Sprites/UI/upLeft_white"); this.MouseBlack = Content.Load <Texture2D>("Sprites/UI/upLeft"); this.Mouse.Sprite = this.MouseWhite; this.Mouse.SetPointMouse(this.World); this.Mouse.Show = true; this.WorldUIMainMenu = new World(); this.WorldUIMainMenu.Gravity = Vector2.Zero; this.Mouse.SetPointMouse(WorldUIMainMenu); this.SetAllLevels(Content); this.SetCreditsScene(); this.SceneMainMenu = new MainMenu(); this.SceneMainMenu.Content = this.Content; this.SceneMainMenu.Font = this.FontRegular; this.SceneMainMenu.FontBold = this.FontBold; this.SceneMainMenu.Screem = this.Screem; this.SceneMainMenu.World = this.World; this.SceneMainMenu.Mouse = this.Mouse; this.SceneMainMenu.Screem = this.Screem; this.SceneMainMenu.Game = this.Game; this.SceneMainMenu.Localization = this.Localization; this.SceneMainMenu.Storage = this.Storage; this.SceneMainMenu.GameManager = this; List <bool> levels = this.Storage.getItemsBool("Progress"); IEnumerable <bool> _levels_progress = from level in levels where level == true select level; if (_levels_progress.ToList <bool>().Count == 0) { this.CurrentlyStatus = GameStatus.PLAY; } else { this.SceneMainMenu.Start(); this.CurrentlyStatus = GameStatus.MAIN_MENU; } }