Пример #1
0
 public void BackToMenu()
 {
     Hide();
     InteractionLogic.Dispose();
     controls.SetControlsToState(GameState.MainMenu);
     HudInterface.Dispose();
     mainMenu.Show();
 }
Пример #2
0
 public void RestartGame()
 {
     InteractionLogic.Restart();
     score = 0;
     HudInterface.SetScoreText(score);
     HudInterface.SetInGameMode();
     GameState = GameState.Playing;
     controls.SetControlsToState(GameState);
 }
Пример #3
0
 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);
 }
Пример #4
0
 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);
 }
Пример #5
0
 public void StartGame()
 {
     mainMenu.Hide();
     Show();
     controls  = new Controls(this);
     score     = 0;
     GameState = GameState.Playing;
     InteractionLogic.BeginGame();
     SetUpEvents();
     controls.SetControlsToState(GameState);
     HudInterface = new HudInterface();
 }
Пример #6
0
 public void GameOver()
 {
     if (GameState == GameState.GameOver)
     {
         return;
     }
     RefreshHighScores();
     InteractionLogic.PauseUpdate();
     InteractionLogic.Player.Dispose();
     GameState = GameState.GameOver;
     controls.SetControlsToState(GameState);
     HudInterface.SetGameOverText();
 }
Пример #7
0
 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>();
 }
Пример #8
0
        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>();
        }
Пример #9
0
        public Asteroid(Vector2D position, InteractionLogic interactionLogic, int sizeModifier = 1)
            : this(Rectangle.FromCenter(position, new Size(0.1f / sizeModifier)), interactionLogic,
				sizeModifier)
        {
        }
Пример #10
0
 public Asteroid(InteractionLogic interactionLogic, int sizeModifier = 1)
     : this(CreateDrawArea(Randomizer.Current, sizeModifier), interactionLogic, sizeModifier)
 {
 }
Пример #11
0
 public Asteroid(Vector2D position, InteractionLogic interactionLogic, int sizeModifier = 1)
     : this(Rectangle.FromCenter(position, new Size(0.1f / sizeModifier)), interactionLogic,
            sizeModifier)
 {
 }
Пример #12
0
 public Asteroid(InteractionLogic interactionLogic, int sizeModifier = 1)
     : this(CreateDrawArea(Randomizer.Current, sizeModifier), interactionLogic, sizeModifier)
 {
 }