Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            cam       = new Camera2d(Config.Instance.GameWidth, Config.Instance.ScreenWidth, Config.Instance.GameHeight, Config.Instance.ScreenHeight);
            cam.Pos   = new Vector2(512.0f, 360.0f);
            mainFrame = new Rectangle(-450, 0, 2400, Config.Instance.GameHeight);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            spriteFont   = Content.Load <SpriteFont>("testf");
            comboManager = new ComboManager(spriteFont);

            BGMManager bgmManager = new BGMManager(Content);

            projectileManager = new ProjectileManager(Content);
            throwManager      = new OneButtonThrowManager();
            superManager      = new BasicSuperManager(cam);

            menuBg = Content.Load <Texture2D>("bg2");

            dummyTexture = new Texture2D(GraphicsDevice, 1, 1);

            dummyTexture.SetData(new Color[] { Color.White });


            testHitbox = new Rectangle(100, 100, 100, 100);

            testHitInfo = new HitInfo(3, 20, Hitzone.HIGH);
            testHitInfo.IsHardKnockDown = true;
            testHitInfo.AirUntechTime   = 8000;
            testHitInfo.AirXVelocity    = 80;
            testHitInfo.AirYVelocity    = -100;

            effect = Content.Load <SoundEffect>("slap_large");

            characterSelection = new CharacterSelectList(Content);

            player1CharacterId = "HuntingHorn";


            PlayerFactory playerFactory = new PlayerFactory();

            playerFactory.DummyTexture = dummyTexture;
            player1 = (HuntingHornPlayer)playerFactory.createCharacter(player1CharacterId, Content, 1, comboManager, throwManager, superManager, projectileManager);

            //player1.Sprite.a
            roundManager   = new RoundManager(player1, player2);
            animationsList = player1.Sprite.AnimationsList;
            player1.Sprite.CurrentAnimation      = animationsList[index];
            player1.Sprite.CurrentAnimation      = "hit";
            player1.ProjectileA.CurrentAnimation = "note1";
        }
Exemplo n.º 2
0
        protected void LoadGame()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();


            Console.WriteLine("Setting up Player1");
            PlayerFactory playerFactory = new PlayerFactory();

            playerFactory.DummyTexture = dummyTexture;

            player1 = playerFactory.createCharacter(player1CharacterId, this.Content, 1, comboManager, throwManager, superManager, projectileManager);
            Console.WriteLine("Player1 set up");
            // Set player 1 default controls
            //
            player1.ControlSetting = player1Controls;

            player2 = playerFactory.createCharacter(player2CharacterId, this.Content, 2, comboManager, throwManager, superManager, projectileManager);
            Console.WriteLine("Player2 set up");
            // Setting player 2 default controls
            //
            player2.ControlSetting = player2Controls;

            //player2.AddSound(strum, "cattack");

            //player1.AddSound(effect, "aattack");
            //player1.AddSound(hit2, "battack");
            //player1.AddSound(slash2, "cattack");
            //player1.AddSound(slash, "2cattack");
            //player1.AddSound(slash2, "rekkaB");
            //player1.AddSound(slash, "rekka");
            //player1.AddSound(slash, "rekkaC");
            //player1.AddSound(Content.Load<SoundEffect>("airbackdash_h"), "backstep");
            //player1.Sprite.AddResetInfo("aattack", 4);
            //  player1.Sprite.AddResetInfo("aattack", 6);

            roundManager = new RoundManager(player1, player2);

            stopwatch.Stop();
            long elapsed_time = stopwatch.ElapsedMilliseconds;

            Console.WriteLine("TOOK " + elapsed_time + " ms to do this");
            if ((int)elapsed_time < 5000)
            {
                Console.WriteLine("Sleeping for a bit");
                Thread.Sleep(5000 - (int)elapsed_time);
            }
            gameState = GameState.PLAYING;
            isLoading = false;
        }
Exemplo n.º 3
0
        public void checkHitOnPlayers(Player player1, Player player2, ComboManager comboManager, RoundManager roundManager, KeyboardState Keyboard, GameState gameState)
        {
            for (int i = player1Projectiles.Count - 1; i >= 0; i--)
            {
                Projectile projectile = player1Projectiles[i];
                if (projectile.Hitbox.Intersects(player2.Sprite.Hurtbox))
                {
                    if (projectile.NumOfHits > 0)
                    {
                        Rectangle collisionZone = Rectangle.Intersect(projectile.Hitbox, player2.Sprite.Hurtbox);

                        comboManager.player1LandedHit(player2.CharacterState);
                        Boolean hitEnemy = player2.hitByEnemy(Keyboard, projectile.CurrentProjectile.HitInfo, collisionZone);
                        player1.hitEnemy(hitEnemy);
                        projectile.hitEnemy();
                    }
                    else
                    {
                        if (!projectile.PlayOnce)
                        {
                            player1Projectiles.RemoveAt(i);
                        }
                    }
                    System.Diagnostics.Debug.WriteLine("We have projectile  1 collision at " + projectile.CurrentProjectile.CurrentFrame);
                    if (player2.CurrentHealth <= 0)
                    {
                        roundManager.roundEnd(1);
                        gameState = GameState.ROUNDEND;
                    }
                }
            }

            for (int j = player2Projectiles.Count - 1; j >= 0; j--)
            {
                Projectile projectile = player2Projectiles[j];
                if (projectile.Hitbox.Intersects(player1.Sprite.Hurtbox))
                {
                    if (projectile.NumOfHits > 0)
                    {
                        Rectangle collisionZone = Rectangle.Intersect(projectile.Hitbox, player1.Sprite.Hurtbox);
                        comboManager.player2LandedHit(player1.CharacterState);
                        Boolean hitEnemy = player1.hitByEnemy(Keyboard, projectile.CurrentProjectile.HitInfo, collisionZone);
                        player2.hitEnemy(hitEnemy);
                        projectile.hitEnemy();
                    }
                    else
                    {
                        if (!projectile.PlayOnce)
                        {
                            player2Projectiles.RemoveAt(j);
                        }
                    }
                    System.Diagnostics.Debug.WriteLine("We have projectile collision at " + projectile.CurrentProjectile.CurrentFrame);
                    if (player1.CurrentHealth <= 0)
                    {
                        roundManager.roundEnd(2);
                        gameState = GameState.ROUNDEND;
                    }
                }
            }
        }