private void GetModelEvents() { Model.GameOver += () => GameState = GameStates.Over; Model.LevelComplete += () => { var index = Levels.IndexOf(Level) + 1; if (index < Levels.Count) { var health = Level.Player.Health; Level = Levels[index]; Level.Player.Health = health; } else { GameState = GameStates.MainMenu; } }; Claws.Attack += (Creature) => Model.AttackIntersection(Creature); Sword.Attack += (Creature) => Model.AttackIntersection(Creature); }
private TableLayoutPanel GetMainMenu() { var panel = new TableLayoutPanel(); panel.Location = new Point(ClientSize.Width / 2, ClientSize.Height / 2); panel.RowStyles.Add(new RowStyle(SizeType.Percent, 50)); panel.RowStyles.Add(new RowStyle(SizeType.Percent, 50)); panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); var newGameButton = new Button() { Size = new Size(300, 200), Text = "New Game" }; newGameButton.Click += (s, arg) => { Levels.Clear(); GetLevels(); GameState = GameStates.InGame; }; panel.Controls.Add(newGameButton, 0, 0); var exitButton = new Button() { Size = new Size(300, 200), Text = "EXIT" }; exitButton.Click += (s, args) => Application.Exit(); panel.Controls.Add(exitButton, 0, 1); panel.Location = new Point(panel.Location.X + panel.Size.Width / 2, panel.Location.Y + panel.Size.Width / 2); return(panel); }
void UpdateDistance() { Point dest = new Point(1105, 28); distance += speed; OInterval += speed; IInterval += speed; TextData.Add(new Tuple <string, Point, int>(distance.ToString(), dest, 30)); DrawItemsOwned(); if (distance > (int)Levels.one) { level = Levels.two; } else if (distance > (int)Levels.two) { level = Levels.three; } else if (distance > (int)Levels.three) { level = Levels.four; } }
public Queue <IEnemyAct> GetLevel() { return(Levels.DefaultLevel(this)); }