public Form1() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); InitializeComponent(); this.BackColor = Color.Black; this.Size = new Size(VALUES.WIDTH, VALUES.HEIGHT + VALUES.PLAYER_HEIGHT); if (false) { setup = new Setup.LevelSetup(); this.MouseClick += MousePop; this.KeyDown += SetupKeyHandle; } InitializePlayer(); StarMap.GenerateRandomMap(STAR_MAP_FILE, 150, currentPlayerTier); level = new StarMap(playerStar, STAR_MAP_FILE, new List <int> { }, PrepareNextLevel); level.Begin(); PLAY(); this.KeyUp += KeyUps; this.Paint += PaintGame; timer = new Timer(); timer.Interval = 100; timer.Tick += new EventHandler(Elapse); timer.Start(); }
private void LoadNextLevel(Setup.LevelInfoHolder info) { ILevelBuilder builder = null; if (info.type == LevelType.Classic) { string pathing = System.IO.Directory.GetCurrentDirectory(); var lvlInfo = Setup.LevelReader.ReadLevel(pathing + @"\LevelFile.txt", info.type); lvlInfo.id = info.id; lvlInfo.tier = info.tier; lvlInfo.type = info.type; lvlInfo.difficulty = info.difficulty; builder = new ClassicLevelBuilder(); SetLevel(lvlInfo, builder); } else if (info.type == LevelType.Event) { string pathing = System.IO.Directory.GetCurrentDirectory(); builder = new Event.EventLevelBuilder(); var lvlInfo = Setup.LevelReader.ReadLevel(pathing + @"\LevelFile.txt", info.type); lvlInfo.id = info.id; SetLevel(lvlInfo, builder); } else { if (info.type == LevelType.Meteor) { builder = new Meteor.MeteorLevelBuilder(); } else if (info.type == LevelType.Shop) { builder = new GroceryLevelBuilder(); } else if (info.type == LevelType.Boss) { builder = new BossLevelBuilder(); } SetLevel(info, builder); } level.Begin(); }
private void TierFinishedAction(bool playerWon) { if (playerWon) { if (currentPlayerTier == Tier.T3) { throw new NotImplementedException("You won"); } currentPlayerTier = (Tier)((int)currentPlayerTier + 1); player.Fuel = 15; StarMap.GenerateRandomMap(STAR_MAP_FILE, 150, currentPlayerTier); level = new StarMap(playerStar, STAR_MAP_FILE, new List <int> { }, PrepareNextLevel); level.Begin(); } else { throw new NotImplementedException("You lose"); } }
private void PrepareSecondView() { secondView.Finished += b => { RetrieveControl(); secondView = null; }; GrantControlToSecondView(); secondView.Begin(); }
private void PrepareSecondView() { equipment.Finished += b => { RetrieveControl(); equipment = null; }; GrantControlToSecondView(); equipment.Begin(); }