コード例 #1
0
ファイル: InGame.cs プロジェクト: Sundanian/OlmoSpil
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            Type = "InGame";

            Player player1 = new Player(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 30, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 16 + 175), 1, "Bob", 1, PlayerId.Player1, 1);
            Player player2 = new Player(new Vector2(140, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 50), 1, "Bob", 1, PlayerId.Player2, 4);
            Player player3 = new Player(new Vector2(350, -25), 1, "Bob", 1, PlayerId.Player3, 3);
            Player player4 = new Player(new Vector2(570, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 50), 1, "Bob", 1, PlayerId.Player4, 2);
            Game1.AddObjects.Add(player1);
            Game1.AddObjects.Add(player2);
            Game1.AddObjects.Add(player3);
            Game1.AddObjects.Add(player4);
            #region Level
            Turret g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 20 - 200, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 20 - 200), 1, 1);
            Game1.AddObjects.Add(g);
            g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 20 + 200, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 20 - 200), 1, 2);
            Game1.AddObjects.Add(g);
            g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 20 - 200, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 20 + 200), 1, 3);
            Game1.AddObjects.Add(g);
            g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 20 + 200, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 20 + 200), 1, 4);
            Game1.AddObjects.Add(g);
            #endregion
            base.LoadContent(content);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: Sundanian/OlmoSpil
        private void CheckDeath()
        {
            if (life <= 0)
            {
                //Block my side
                switch (team)
                {
                    case 1:
                        for (int i = 0; i < 9; i++)
                        {
                            Turret g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 180 + (40 * i), Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 20 + 200), 1, 5);
                            Game1.AddObjects.Add(g);
                        }
                        break;
                    case 2:
                        for (int i = 0; i < 9; i++)
                        {
                            Turret g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 20 + 200, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 180 + (40 * i)), 1, 5);
                            Game1.AddObjects.Add(g);
                        }

                        break;
                    case 3:
                        for (int i = 0; i < 9; i++)
                        {
                            Turret g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 180 + (40 * i), Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 20 - 200), 1, 5);
                            Game1.AddObjects.Add(g);
                        }
                        break;
                    case 4:
                        for (int i = 0; i < 9; i++)
                        {
                            Turret g = new Turret(new Vector2(Game1.Graphics.GraphicsDevice.Viewport.Width / 2 - 20 - 200, Game1.Graphics.GraphicsDevice.Viewport.Height / 2 - 180 + (40 * i)), 1, 5);
                            Game1.AddObjects.Add(g);
                        }
                        break;
                    default:
                        break;
                }
                //Sent "I am dead" to server

                //Removes this
                Game1.RemoveObjects.Add(this);
            }
        }