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