コード例 #1
0
        public float Mass; //Mass to calculate Forces

        public GameElement(ref GameApplication App, ref NewGame Game)
            : base(App)
        {
            this.App      = App;
            this.Game     = Game;
            this.Position = new Vector2(0, 0);
        }
コード例 #2
0
        public GameApplication()
        {
            #region XNA.
            this.IsMouseVisible  = true;
            this.IsFixedTimeStep = true;
            this.Graphics        = new GraphicsDeviceManager(this);
            this.Graphics.PreferMultiSampling       = true;
            this.Graphics.PreferredBackBufferHeight = 768;
            this.Graphics.PreferredBackBufferWidth  = 1366;
            this.Graphics.IsFullScreen = true;
            this.Graphics.ApplyChanges();
            this.Content.RootDirectory = "Content";
            #endregion

            #region Application.
            this.AppState           = AppState.MainMenu;
            this.Application        = this;
            this.GameEnd            = new GameOver();
            this.InstructionsWindow = new InstructionsWindow();
            this.MainMenu           = new MainMenu();
            this.Game      = new NewGame(ref this.Application);
            this.PauseMenu = new PauseMenu();
            this.StopWatch = new Stopwatch();
            this.UI        = new UI(ref this.Application);
            #endregion

            this.Mute = false;
        }
コード例 #3
0
 public Puck(ref GameApplication App, ref NewGame Game)
     : base(ref App, ref Game)
 {
     this.Velocity            = Vector2.Zero;
     this.PreviousPosition    = Vector2.Zero;
     this.FrictionCoefficient = 0.5f;
     this.Acceleration        = new Vector2(this.FrictionCoefficient * 9.8f, this.FrictionCoefficient * 9.8f);
     this.MaximumSpeed        = 125;
     this.Mass            = 0.05f;
     this.CornerCollision = false;
 }
コード例 #4
0
ファイル: NewGame.cs プロジェクト: adrirach/AirHockey
 public NewGame(ref GameApplication Application)
 {
     this.Application = Application;
     this.Game        = this;
     this.CPU         = new CPU(ref this.Application, ref this.Game);
     this.GameState   = GameState.Running;
     this.Player      = new Player(ref this.Application, ref this.Game);
     this.Puck        = new Puck(ref this.Application, ref this.Game);
     this.Scoreboard  = new Scoreboard(ref this.Application);
     this.StopWatch   = new Stopwatch();
     this.Table       = new Table(ref this.Application, ref this.Game);
 }
コード例 #5
0
ファイル: Menu.cs プロジェクト: adrirach/AirHockey
        //  Member methods.
        /// <summary>
        /// Drawing the main menu buttons.
        /// </summary>
        /// <param name="Game"> The game where the main menu would be drawn. </param>
        ///
        public void Draw(ref NewGame Game)
        {
            MouseState State    = Mouse.GetState(); //  Getting mouse position.
            Vector2    Position = new Vector2();
            Vector2    Origin   = new Vector2();
            Color      Color    = Color.Red * 1.5f;

            //  Setting background.
            Game.spriteBatch.Draw(Game.Content.Load <Texture2D>("MenuBackGround"), Game.graphics.GraphicsDevice.Viewport.Bounds, Color.White);

            //  The position where the start button would be drawn.
            Position.X = Game.graphics.GraphicsDevice.Viewport.Width / 2;
            Position.Y = Game.graphics.GraphicsDevice.Viewport.Height / 2 - 100;

            //  The origin of the start button.
            Origin = Game.Font.MeasureString("Start") / 2;

            //  Incase the mouse position is inside the start button.
            if (State.X >= StartButtonBeginX &&
                State.X <= StartButtonEndX &&
                State.Y >= StartButtonBeginY &&
                State.Y <= StartButtonEndY)
            {
                Color = Color.White;   //  Adding vitality by changing the used color.
            }

            //  Drawing the start button.
            Game.spriteBatch.DrawString(Game.Font, "Start", Position, Color, 0, Origin, 0.5f, SpriteEffects.None, 0.5f);

            Color = Color.Red * 1.5f;

            //  The position where the exit button would be drawn.
            Position.Y += 200;

            //  The origin of the exit button.
            Origin = Game.Font.MeasureString("Exit") / 2;

            //  Incase the mouse position is inside the exit button.
            if (State.X >= ExitButtonBeginX &&
                State.X <= ExitButtonEndX &&
                State.Y >= ExitButtonBeginY &&
                State.Y <= ExitButtonEndY)
            {
                Color = Color.White;   //  Adding vitality by changing the used color.
            }

            //  Drawing the exit button.
            Game.spriteBatch.DrawString(Game.Font, "Exit", Position, Color, 0, Origin, 0.5f, SpriteEffects.None, 0.5f);
        }
コード例 #6
0
 public Player_Paddle(NewGame game)
     : base(game)
 {
     Velocity = new Vector2(0, 0);
 }
コード例 #7
0
 public Table(ref GameApplication App, ref NewGame Game)
     : base(App)
 {
     this.Game = Game;
     this.App  = App;
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: adrirach/AirHockey
 public Player(ref GameApplication App, ref NewGame Game)
     : base(ref App, ref Game)
 {
     this.PlayerPaddle = new PlayerPaddle(ref App, ref Game);
 }
コード例 #9
0
ファイル: Paddle.cs プロジェクト: adrirach/AirHockey
 public Paddle(ref GameApplication App, ref NewGame Game)
     : base(ref App, ref Game)
 {
     this.Mass     = 0.135f;
     this.Position = new Vector2(0, 0);
 }
コード例 #10
0
 public PlayerPaddle(ref GameApplication App, ref NewGame Game)
     : base(ref App, ref Game)
 {
     this.Velocity = new Vector2(0, 0);
 }
コード例 #11
0
ファイル: CPU.cs プロジェクト: adrirach/AirHockey
 public CPU(ref GameApplication App, ref NewGame Game) : base(ref App, ref Game)
 {
     this.CPUPaddle = new CPUPaddle(ref App, ref Game);
 }
コード例 #12
0
ファイル: Score.cs プロジェクト: adrirach/AirHockey
 public Score(NewGame game)
 {
     this.game = game;
 }
コード例 #13
0
 public CPU_Paddle(NewGame game)
     : base(game)
 {
     Velocity = Vector2.Zero;
 }
コード例 #14
0
 public User(ref GameApplication App, ref NewGame Game)
     : base(App)
 {
 }
コード例 #15
0
 public CPUPaddle(ref GameApplication App, ref NewGame Game)
     : base(ref App, ref Game)
 {
     this.Velocity = Vector2.Zero;
 }