Пример #1
0
 public override void LoadState(BoxingPlayer player, Dictionary <string, Animation> ATextures)
 {
     this.StatePlayer        = player;
     this.PlayerAnimation    = ATextures[StateName];
     StatePlayer.isAttacking = false;
     StatePlayer.isHit       = false;
 }
Пример #2
0
        public BowlerHatInstance(BoxingPlayer player, Dictionary <string, Animation> animations, int id, float speedFactor) :
            base(player, false, id)
        {
            direction     = player.direction;
            moveDirection = player.direction;
            damage        = 1;

            speed *= speedFactor;
            Debug.WriteLine("Speed = " + speed);

            scale          = BoxingPlayer.Scale;
            hatOffset     *= scale;
            leftHatOffset *= scale;
            if (direction == -1)
            {
                speed   *= -1;
                position = Vector2.Add(player.position, leftHatOffset);
            }
            else
            {
                position = Vector2.Add(player.position, hatOffset);
            }

            hitbox = new Rectangle((int)position.X, (int)position.Y, (int)(width * scale), (int)(height * scale));

            anim = animations["bowlerHat"];
            sprite.PlayAnimation(anim);
        }
Пример #3
0
        public PlayerStatDisplay(SpriteFont font, int player_index, BoxingPlayer player, Input_Handler input, Rectangle bounds, Texture2D background, Texture2D bar)
        {
            this.player     = player;
            this.bounds     = bounds;
            this.background = background;
            this.tBar       = bar;
            this.health     = player.MaxHealth;
            this.stamina    = player.MaxStamina;
            this.input      = input;
            this.isActive   = input.isActive;

            title = "Player " + player_index;

            //===================Initialize positions====================
            int margin = 1; // the whitespace around the entry

            // Dimensions of the strings
            int stringHeight = (int)font.MeasureString("S").Y;
            int stringWidth  = (int)font.MeasureString("MMM").X;

            // Dimensions of the bars
            int textX     = bounds.X + stringWidth / 2;
            int barHeight = (int)(1.5f * stringHeight / 3);

            int barX = bounds.X + (int)(1.25f * stringWidth + 2);

            // Portions?
            int vertical_Portion = bounds.Height / 14;
            int textWidth        = bounds.Width / 3;

            barWidth = bounds.X + bounds.Width - barX - 4;
            Vector2 start = new Vector2(bounds.X, bounds.Y);

            // Set position of the Title
            vTitle = new Vector2(bounds.X + bounds.Width / 2 - font.MeasureString(title).X, bounds.Y);

            vHealth  = new Vector2(textX + margin, start.Y + margin + (1 * (stringHeight) + (1 * 2 * margin)));
            vStamina = new Vector2(textX + margin, start.Y + margin + (2 * (stringHeight) + (2 * 2 * margin)));

            rHealth  = new Rectangle(barX, (int)start.Y + margin + (1 * (stringHeight) + (1 * 2 * margin)), barWidth, stringHeight);
            rStamina = new Rectangle(barX, (int)start.Y + margin + (2 * (stringHeight) + (2 * 2 * margin)), barWidth, stringHeight);

            Debug.WriteLine("rHealth.Y = " + rHealth.Y);

            rHealth.Width  = (int)(barWidth * (player.CurrentHealth / player.MaxHealth));
            rStamina.Width = (int)(barWidth * (player.CurrentStamina / player.MaxStamina));

            int squarewidth = bounds.Width / 8;

            // Set position of ability cooldown squares
            for (int i = 0; i < 4; i++)
            {
                rAbilities[i] = new Rectangle(((i + 1) * (bounds.X + bounds.Width) / 5) - squarewidth / 2,
                                              (int)start.Y + margin + (3 * (stringHeight) + (3 * 2 * margin)), squarewidth, squarewidth);
                //Debug.WriteLine("Player " + player_index + " square " + (i + 1) + " initialized");
                Debug.WriteLine("Player " + player_index + " square. X = " + rAbilities[i].X + "square.Y = " + rAbilities[i].Y);
            }
        }
Пример #4
0
 public override void LoadState(BoxingPlayer player, Dictionary <string, Animation> ATextures)
 {
     this.StatePlayer        = player;
     this.ATextures          = ATextures;
     this.PlayerAnimation    = ATextures[StateName];
     this.speed              = new Vector2(Tools.speedCalc(StatePlayer.MaxMovement), Tools.Y_SCALE * Tools.speedCalc(StatePlayer.MaxMovement));
     StatePlayer.isAttacking = false;
     StatePlayer.isHit       = false;
 }
Пример #5
0
        public override void LoadState(BoxingPlayer player, Dictionary <string, Animation> ATextures)
        {
            this.StatePlayer        = player;
            this.PlayerAnimation    = ATextures[StateName];
            StatePlayer.isAttacking = true;

            // if (StatePlayer.PlayerEffect == SpriteEffects.None)
            //   StatePlayer.Hitbox = new Rectangle((int)StatePlayer.Position.X,(int)StatePlayer.Position.Y,Tools.WIDTH, Tools.HEIGHT);
        }
Пример #6
0
        public override void LoadState(BoxingPlayer player, Dictionary <string, Animation> ATextures)
        {
            this.StatePlayer        = player;
            this.PlayerAnimation    = ATextures[StateName];
            StatePlayer.isAttacking = false;
            StatePlayer.isHit       = false;
            if (StatePlayer.KeysDown.Contains(KeyPressed.Left) && !StatePlayer.KeysDown.Contains(KeyPressed.Right))
            {
                Direction = DirectionType.Left;
            }
            else if (StatePlayer.KeysDown.Contains(KeyPressed.Right) && !StatePlayer.KeysDown.Contains(KeyPressed.Left))
            {
                Direction = DirectionType.Right;
            }
            else
            {
                Direction = DirectionType.Up;
            }

            Counter   = -CounterConst;
            hasJumped = false;
        }
Пример #7
0
 public abstract void LoadState(BoxingPlayer player, Dictionary<string,Animation> ATextures);
Пример #8
0
 public ItemInstance(BoxingPlayer player, bool isEffect, int id)
 {
     this.player   = player;
     this.isEffect = isEffect;
     this.id       = id;
 }
Пример #9
0
 //public abstract ItemInstance GenerateInstance(Vector3 position, int id, SpriteEffects effect);
 public abstract State GetState(int itemIndex, BoxingPlayer player, KeyPressed key);//int itemindex);
Пример #10
0
        //public override ItemInstance GenerateInstance(Vector3 position, int id, SpriteEffects effect)
        //{
        //    return new CaneInstance(this, instanceTexture, position, id, effect);
        //}

        public override State GetState(int itemIndex, BoxingPlayer player, KeyPressed key)
        {
            return(new StateCape(itemIndex, player, key));
        }
Пример #11
0
 public void addBowlerHat(BoxingPlayer p, float multiplier)
 {
     itemInstances.Add(new BowlerHatInstance(p, itemAnims, instanceID++, multiplier));
 }