public void BackToMenu() { Hide(); InteractionLogic.Dispose(); controls.SetControlsToState(GameState.MainMenu); HudInterface.Dispose(); mainMenu.Show(); }
public void RestartGame() { InteractionLogic.Restart(); score = 0; HudInterface.SetScoreText(score); HudInterface.SetInGameMode(); GameState = GameState.Playing; controls.SetControlsToState(GameState); }
public Game(Window window) { highScores = new int[10]; TryLoadingHighscores(); SetUpBackground(); mainMenu = new Menu(); mainMenu.InitGame += StartGame; mainMenu.QuitGame += window.CloseAfterFrame; InteractionLogic = new InteractionLogic(); mainMenu.UpdateHighscoreDisplay(highScores); }
public void StartGame() { mainMenu.Hide(); Show(); controls = new Controls(this); score = 0; GameState = GameState.Playing; InteractionLogic.BeginGame(); SetUpEvents(); controls.SetControlsToState(GameState); HudInterface = new HudInterface(); }
public void GameOver() { if (GameState == GameState.GameOver) { return; } RefreshHighScores(); InteractionLogic.PauseUpdate(); InteractionLogic.Player.Dispose(); GameState = GameState.GameOver; controls.SetControlsToState(GameState); HudInterface.SetGameOverText(); }
private Asteroid(Rectangle drawArea, InteractionLogic interactionLogic, int sizeModifier) : base(new Material(Shader.Position2DColorUV, "Asteroid"), drawArea) { var randomizer = Randomizer.Current; this.interactionLogic = interactionLogic; this.sizeModifier = sizeModifier; RenderLayer = (int)AsteroidsRenderLayer.Asteroids; var data = new SimplePhysics.Data { Gravity = Vector2D.Zero, Velocity = GetInitialVelocity(randomizer), RotationSpeed = randomizer.Get(.1f, 50) }; Add(data); Start<SimplePhysics.Move>(); Start<MoveCrossingScreenEdges>(); Start<SimplePhysics.Rotate>(); }
private Asteroid(Rectangle drawArea, InteractionLogic interactionLogic, int sizeModifier) : base(new Material(ShaderFlags.Position2DColoredTextured, "Asteroid"), drawArea) { var randomizer = Randomizer.Current; this.interactionLogic = interactionLogic; this.sizeModifier = sizeModifier; RenderLayer = (int)AsteroidsRenderLayer.Asteroids; var data = new SimplePhysics.Data { Gravity = Vector2D.Zero, Velocity = GetInitialVelocity(randomizer), RotationSpeed = randomizer.Get(.1f, 50) }; Add(data); Start <SimplePhysics.Move>(); Start <MoveCrossingScreenEdges>(); Start <SimplePhysics.Rotate>(); }
public Asteroid(Vector2D position, InteractionLogic interactionLogic, int sizeModifier = 1) : this(Rectangle.FromCenter(position, new Size(0.1f / sizeModifier)), interactionLogic, sizeModifier) { }
public Asteroid(InteractionLogic interactionLogic, int sizeModifier = 1) : this(CreateDrawArea(Randomizer.Current, sizeModifier), interactionLogic, sizeModifier) { }