コード例 #1
0
ファイル: ResultScene.cs プロジェクト: patHyatt/Frenemey
        public ResultScene(Bomberman winner)
        {
            string message = "Everyone is a loser.";
            if (winner != null)
                message = string.Format("{0} is the greatest!", winner.Session.Name);

            _titleMessage = new Text(message, 32)
            {
                Color = Color.Red,
                X = this.HalfWidth,
                Y = this.HalfHeight,
            };

            _instructionMessage = new Text("Press any key to replay", size: 20)
            {
                Color = Color.White,
                OutlineThickness = .5f,
                X = this.HalfWidth,
                Y = this.HalfHeight + 200
            };

            this.AddGraphic(_titleMessage);
            this.AddGraphic(_instructionMessage);

            this.OnUpdate = () =>
            {
                if (Game.Input.ButtonPressed(AxisButton.Any) || Game.Input.KeyPressed(Key.Any))
                {
                    Game.SwitchScene(new GameScene(1, Game.Input.JoysticksConnected));
                }
            };
        }
コード例 #2
0
ファイル: Bomb.cs プロジェクト: patHyatt/Frenemey
        public Bomb(Bomberman owner)
        {
            this.Radius = owner.BombRadius > 0 ? owner.BombRadius : BASE_RADIUS;

            _bombImage = new Image("Assets/Images/sprites.png", new Rectangle(0, 0, Global.GridSize, Global.GridSize));
            this.Graphic = _bombImage;

            this.Layer = 2;

            this.SetHitbox(Global.GridSize, Global.GridSize, (int)CollisionTag.Bomb);
            this.Collidable = false;

            this.Owner = owner;

            float x = Util.SnapToGrid(owner.X, Global.GridSize, 16);
            float y = Util.SnapToGrid(owner.Y, Global.GridSize);

            this.SetPosition(x, y);
        }
コード例 #3
0
ファイル: Bomberman.cs プロジェクト: patHyatt/Frenemey
        public static void CreateFromXML(Scene scene, XmlAttributeCollection attributes)
        {
            int playerNumber = attributes.Int("player", 0);

            Session playerSession;
            Color color = Color.None;

            if (playerNumber == 0)
            {
                playerSession = Global.PlayerOneSession;
                color = Color.White;
            }
            else if (playerNumber == 1)
            {
                playerSession = Global.PlayerTwoSession;
                color = Color.Yellow;
            }
            else if (playerNumber == 2)
            {
                playerSession = Global.PlayerThreeSession;
                color = Color.Blue;
            }
            else
            {
                playerSession = Global.PlayerFourSession;
                color = Color.Grey;
            }

            Bomberman player = new Bomberman(playerSession, color);

            player.SetPosition(attributes.Int("x", 0), attributes.Int("y", 0));

            scene.Add(player);
        }