Esempio n. 1
0
        public override void Activate(GameTime gameTime, KeyboardState keyboardState, KeyboardState pastKeyboardState, MouseState mouseState, MouseState pastMouseState, GameMap map, StandardAttacker player)
        {
            player.SpriteManager.RemoveSpriteEvent(gameTime);
            player.SpriteManager.SetSpriteEvent(StandardAttacker.AttackEventSpritePosition(StandardAttacker.AttackEvent.AirAttackDown), gameTime, OnEventEnd: new EventHandler((e, s) => { player.HandleAttackEnd(); }));

            player.ClientCollider.SetCollisionPolygon(player.AttackColliders[(int)StandardAttacker.AttackEvent.AirAttackDown][0]);
            player.ClientCollider.ActiveCollider = true;
            player.RestrictedMobility            = true;

            //Air lunge
            player.RigidBody.AddTranslationalVelocity(new Vector2(0, lungeSpeed), isGlobal: false);
        }
Esempio n. 2
0
        public override void Activate(GameTime gameTime, KeyboardState keyboardState, KeyboardState pastKeyboardState, MouseState mouseState, MouseState pastMouseState, GameMap map, StandardAttacker player)
        {
            bool willActivate = false;

            StandardAttacker.AttackEvent eventToActivate = StandardAttacker.AttackEvent.SideAttackLight;
            if (mouseState.LeftButton == ButtonState.Pressed && pastMouseState.LeftButton == ButtonState.Released)
            {
                willActivate    = true;
                eventToActivate = StandardAttacker.AttackEvent.SideAttackLight;
            }
            else if (mouseState.RightButton == ButtonState.Pressed && pastMouseState.RightButton == ButtonState.Released)
            {
                willActivate    = true;
                eventToActivate = StandardAttacker.AttackEvent.SideAttackHeavy;
            }

            if (willActivate)
            {
                int comboLevel;
                if (StandardAttacker.AttackEventSpritePosition(eventToActivate) != player.SpriteManager.SpriteEventIndex)
                {
                    comboLevel = 0;
                }
                else
                {
                    comboLevel = player.SpriteManager.SheetSpecification + 1;
                }

                player.SpriteManager.RemoveSpriteEvent(gameTime);
                player.SpriteManager.SetSpriteEvent(StandardAttacker.AttackEventSpritePosition(eventToActivate), gameTime, OnEventEnd: new EventHandler((e, s) => { player.HandleAttackEnd(); }), sheetSpecification: comboLevel);

                player.ClientCollider.SetCollisionPolygon(player.AttackColliders[(int)eventToActivate][comboLevel]);
                player.ClientCollider.ActiveCollider = true;
                player.RestrictedMobility            = true;
                if (eventToActivate == StandardAttacker.AttackEvent.SideAttackHeavy)
                {
                    player.Mobile = false;
                    player.ClientCollider.CollisionDamage = Player.DEFAULT_PLAYER_DAMAGE + 3;
                }

                player.ClientCollider.CollisionDamage *= (comboLevel + 1);

                //Lunge
                if (player.SpriteManager.FacingState == SpriteManager.FacingStates.Left)
                {
                    player.RigidBody.AddTranslationalVelocity(new Vector2(-lungeSpeed, 0), isGlobal: false);
                }
                else
                {
                    player.RigidBody.AddTranslationalVelocity(new Vector2(lungeSpeed, 0), isGlobal: false);
                }
            }
            else
            {
                throw new Exception("Activation called incorrectly!");
            }
        }