Beispiel #1
0
        public GameState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content)
        {
            round      = 0;
            playerWins = 0;
            enemyWins  = 0;
            var        backgroundTexture = _content.Load <Texture2D>("Menu Backgrounds/Stone Brick Background");
            Background background        = new Background(backgroundTexture);

            var uiFont = _content.Load <SpriteFont>("Fonts/Font");

            player = new PlayerSouth(game);
            player.LoadContent(content);
            player.Initialize(180, 300);

            player2 = new PlayerNorth(game);
            player2.LoadContent(content);
            player2.Initialize(180, 300);

            var uiTexture = _content.Load <Texture2D>("Menu Backgrounds/ThirteenthBellUI_NoBackground");

            userInterface = new UserInterface(uiTexture, uiFont)
            {
                playerStackText = "Test Text", //Hopefully we'll be able to plug in the different player stats for these
                playerLifeText  = Convert.ToString(player.life),
                enemyStackText  = "Test Text",
                enemyLifeText   = Convert.ToString(player2.life),
                roundText       = round,
                playerText      = playerWins,
                enemyText       = enemyWins,
            };

            LaneSet laneSet = new LaneSet(_content, 0, 0, 0);

            stack      = new Stack(_content, 30, 0);
            enemyStack = new Stack(_content, 30, 1);

            playerHand = new PlayableCards(5, stack, 0, player, 0);
            enemyHand  = new PlayableCards(5, enemyStack, 1, player2, 1);

            _components = new List <Component>
            {
                background,
                userInterface,
                laneSet,
                stack,
                enemyStack,
                playerHand,
                enemyHand
            };
        }
Beispiel #2
0
        public RoundState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content, int roundNumber, int pWins, int eWins, int wI, bool p) : base(game, graphicsDevice, content)
        {
            round        = roundNumber;
            winIndicator = wI;

            var buttonTexture = _content.Load <Texture2D>("Controls/Play Game");
            var buttonFont    = _content.Load <SpriteFont>("Fonts/Font");
            var otherFont     = _content.Load <SpriteFont>("Fonts/LargerFont");

            ri = new RoundIntro(buttonTexture, buttonFont)
            {
                Position = new Vector2(488, 300),
                Text     = "Round " + round + " starts on the 13th Bell \n" + "                        "
            };

            //Console.WriteLine("Round: " + round);
            playerWins = pWins;
            //Console.WriteLine("Player Wins: " + playerWins);
            enemyWins = eWins;
            //Console.WriteLine("Enemy Wins: " + enemyWins);
            List <Texture2D> uiBackgrounds = new List <Texture2D>();

            var    backgroundTexture  = _content.Load <Texture2D>("Menu Backgrounds/5"); uiBackgrounds.Add(backgroundTexture);
            var    backgroundTexture2 = _content.Load <Texture2D>("Menu Backgrounds/6"); uiBackgrounds.Add(backgroundTexture2);
            var    backgroundTexture3 = _content.Load <Texture2D>("Menu Backgrounds/4"); uiBackgrounds.Add(backgroundTexture3);
            Random r = new Random();

            Background background = new Background(uiBackgrounds.ElementAt(r.Next(uiBackgrounds.Count)));

            var uiFont = _content.Load <SpriteFont>("Fonts/Font");

            player = new PlayerSouth(game);
            player.LoadContent(content);
            player.Initialize(180, 300);

            player2 = new PlayerNorth(game);
            player2.LoadContent(content);
            player2.Initialize(180, 300);


            var uiTexture = _content.Load <Texture2D>("Menu Backgrounds/ThirteenthBellUI_NoBackground");

            particleTexture = _content.Load <Texture2D>("Particle");


            userInterface = new UserInterface(uiTexture, otherFont)
            {
                playerStackText = "",
                playerLifeText  = Convert.ToString(player.life),
                enemyStackText  = "",
                enemyLifeText   = Convert.ToString(player2.life),
                roundText       = round,
                playerText      = playerWins,
                enemyText       = enemyWins,
            };

            LaneSet laneSet = new LaneSet(_content, 0, 0, 0);

            stack      = new Stack(_content, 30, 0);
            enemyStack = new Stack(_content, 30, 1);

            playerHand = new PlayableCards(5, stack, 0, player, 0);
            enemyHand  = new PlayableCards(5, enemyStack, 1, player2, 1);

            _components = new List <Component>
            {
                background,
                userInterface,
                laneSet,
                stack,
                enemyStack,
                playerHand,
                enemyHand,
                ri,
            };

            Random random = new Random();

            //Load Rain Particle----------------------------------------------------------------
            rain = new ParticleSystem(graphicsDevice, 1000, particleTexture);
            rain.SpawnPerFrame = 2;
            rain.SpawnParticle = (ref Particle particle) =>
            {
                // MouseState mouse = Mouse.GetState();
                particle.Position = new Vector2(random.Next(0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width), 0);
                particle.Velocity = new Vector2(
                    MathHelper.Lerp(0, 1, (float)random.NextDouble()),   // X between -50 and 50
                    MathHelper.Lerp(0, 1042, (float)random.NextDouble()) // Y between 0 and 100
                    );
                particle.Acceleration = 0.1f * new Vector2(0, (float)-random.NextDouble());
                particle.Color        = Color.Aqua;
                particle.Scale        = 1f;
                particle.Life         = 1.0f;
            };
            // Set the UpdateParticle method
            rain.UpdateParticle = (float deltaT, ref Particle particle) =>
            {
                particle.Velocity += deltaT * particle.Acceleration;
                particle.Position += deltaT * particle.Velocity;
                particle.Scale    -= deltaT;
                particle.Life     -= deltaT;
            };

            playerHand.SetFalse();
            enemyHand.SetFalse();
        }