예제 #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
파일: Game.cs 프로젝트: remy22/DeltaEngine
 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)
 {
 }