Inheritance: IComponent, IDisposable
Beispiel #1
0
 public ScoreBoard()
 {
     this.scoreBoardPlayer1 = "";
     this.scoreBoardPlayer2 = "";
     p1Bounds.X = 0; p1Bounds.Y = 0;
     p2Bounds.X = 0; p2Bounds.Y = 0;
     GraphicsDevice = SGL.Components.Get<GraphicsDevice>();
 }
Beispiel #2
0
        public Ball()
        {
            gr = new GameRandom();
            GraphicsDevice = SGL.Components.Get<GraphicsDevice>();
            inputManager = SGL.Components.Get<InputManager>();

            this.speed = 5;
            this.Position = new Vector2(GraphicsDevice.BackBuffer.Width / 2, GraphicsDevice.BackBuffer.Height / 2);
            this.directionX = gr.Next(0, 100) <= 50 ? -1 : +1;
            this.directionY = gr.Next(0, 100) <= 50 ? -1 : +1;
        }
Beispiel #3
0
 public Schlaeger(Vector2 startPosition)
 {
     this.Position = startPosition;
     inputManager = SGL.Components.Get<InputManager>();
     gd = SGL.Components.Get<GraphicsDevice>();
 }
Beispiel #4
0
 /// <summary>
 /// Initialisieren der privaten Member
 /// </summary>
 public override void Initialize()
 {
     GraphicsDevice = SGL.Components.Get<GraphicsDevice>();
     inputManager = SGL.Components.Get<InputManager>();
     sceneManager = SGL.Components.Get<SceneManager>();
     ball = new Content.Ball();
     sL = new Content.Schlaeger(new Vector2(10, 250));
     sL.KeyMoveDown = Keys.S;
     sL.KeyMoveUp = Keys.W;
     sR = new Content.Schlaeger(new Vector2(780,250));
     sR.KeyMoveDown = Keys.Down;
     sR.KeyMoveUp = Keys.Up;
     int w = GraphicsDevice.BackBuffer.Width;    //800
     int h = GraphicsDevice.BackBuffer.Height;   //600
     this.torLinks        = new Rectangle(    9, 0, 1, h);
     this.begrenzungOben  = new Rectangle(    0, 0, w, 1);
     this.torRechts       = new Rectangle(w - 9, 0, 1, h);
     this.begrenzungUnten = new Rectangle(    0, h, w, 1);
     scoreBoard = new Content.ScoreBoard()
     {
         Color = Color.White,
         Font = new Font("Arial", 15f, TypefaceStyle.Regular),
         Pen = new Pen(Color.White, 15f),
         Spieler1 = new Content.Player()
         {
             Name = "Spieler1"
         },
         Spieler2 = new Content.Player()
         {
             Name = "Spieler2"
         }
     };
 }
Beispiel #5
0
 /// <summary>
 /// Initialisieren der privaten Member
 /// </summary>
 public override void Initialize()
 {
     inputManager = SGL.Components.Get<InputManager>();
     sceneManager = SGL.Components.Get<SceneManager>();
     graphicsDevice = SGL.Components.Get<GraphicsDevice>();
     gameScene = this.sceneManager.Get<GameScene>();
 }
Beispiel #6
0
 /// <summary>
 /// Initialisieren der privaten Member
 /// </summary>
 public override void Initialize()
 {
     GraphicsDevice = SGL.Components.Get<GraphicsDevice>();
     SceneManager = SGL.Components.Get<SceneManager>();
 }