Beispiel #1
0
        public Player createCharacter(String CharacterId, ContentManager content, int playerNumber,
                                      ComboManager comboManager, ThrowManager throwManager, SuperManager superManager, ProjectileManager projectileManager)
        {
            Player player;

            int       xPosition;
            int       healthBarMargin;
            Texture2D healthBar       = content.Load <Texture2D>("healthBar1");
            Texture2D healthOuterBar  = content.Load <Texture2D>("HealthBar_empty");
            Texture2D specialBar      = content.Load <Texture2D>("specialbar2");
            Texture2D specialOuterBar = content.Load <Texture2D>("Special_4split_empty");
            Direction direction;

            if (playerNumber == 1)
            {
                xPosition       = Config.Instance.Player1XPosition;
                healthBarMargin = ((Config.Instance.ScreenWidth / 2) - 600) / 2;
                direction       = Direction.Right;
            }
            else
            {
                xPosition       = Config.Instance.Player2XPosition;
                healthBarMargin = (((Config.Instance.ScreenWidth / 2) - 600) / 2) + (Config.Instance.ScreenWidth / 2);
                direction       = Direction.Left;
            }
            Gauge HealthBar = new Gauge(healthBar, 20, healthBarMargin, playerNumber, 10, new Rectangle(0, 0, 1276, 150));

            HealthBar.OuterBarTexture = healthOuterBar;
            if (CharacterId.Equals("LongSword"))
            {
                player = new LongSwordPlayer(playerNumber, xPosition, Config.Instance.PlayerYHeight, comboManager, throwManager, HealthBar);
            }
            else if (CharacterId.Equals("HuntingHorn"))
            {
                player = new HuntingHornPlayer(playerNumber, xPosition, Config.Instance.PlayerYHeight + 50, comboManager, throwManager, HealthBar);
            }
            else
            {
                player = new LongSwordPlayer(playerNumber, xPosition, Config.Instance.PlayerYHeight, comboManager, throwManager, HealthBar);
            }
            player.SuperManager        = superManager;
            player.ProjectileManager   = projectileManager;
            player.Sprite.dummyTexture = DummyTexture;

            player.SpecialBar = new Gauge(specialBar, 675, healthBarMargin + 90, playerNumber, 15, new Rectangle(0, 0, 934, 68));
            player.SpecialBar.CurrentAmount   = 100;
            player.SpecialBar.MaxAmount       = 100;
            player.SpecialBar.OuterBarTexture = specialOuterBar;

            player.Direction = direction;
            player.setUpGauges(content, healthBarMargin + 90);

            loadCharacterDataConfigs(CharacterId, player, content);
            loadParticles(CharacterId, player, content);
            player.SetUpUniversalAttackMoves();

            return(player);
        }
Beispiel #2
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";
        }