コード例 #1
0
        public override void OnInput()
        {
            var player = (Player)Human;

            if (SawAction == SawState.Spinning)
            {
                HandleMoveInput(player);
                if (player.OnGround)
                {
                    HandleJumpInput(player);
                }
            }
            if (!player.Controls.AttackHeld)
            {
                switch (SawAction)
                {
                case (SawState.WindUp):
                    SawAction = SawState.WindDown;
                    break;

                case (SawState.Spinning):
                    SawAction = SawState.WindDown;
                    break;
                }
            }
        }
コード例 #2
0
        public override void UpdateDelta(float delta)
        {
            if (Human.InAir && Human.Velocity.Y > 0)
            {
                Human.Velocity.Y = 0.25f;
            }
            switch (SawAction)
            {
            case (SawState.WindUp):
                WindUpTime      += delta * 0.25f;
                Pitch            = WindUpTime.Slide;
                SawEffect.Angle += GetFacingVector(Human.Facing).X *WindUpTime.Slide;
                if (CreationEffect is null)
                {
                    CreationEffect = new ParryEffect(Human.World, Position = Human.Position - new Vector2(8, 8) + Human.Pose.GetWeaponOffset(Human.Facing.ToMirror()) + AngleToVector(Human.Pose.Weapon.GetAngle(Human.Facing.ToMirror())) * 24, 0, 20);
                }
                CreationEffect.Angle = SawEffect.Angle;
                if (WindUpTime.Done)
                {
                    SawAction = SawState.Spinning;
                }
                break;

            case (SawState.Spinning):
                Pitch    = 1.0f;
                Position = Human.Position - new Vector2(8, 8) + Human.Pose.GetWeaponOffset(Human.Facing.ToMirror()) + AngleToVector(Human.Pose.Weapon.GetAngle(Human.Facing.ToMirror())) * 24;

                if (!Human.InAir)
                {
                    WalkFrame += Math.Abs(Human.Velocity.X * delta * 0.125f) / (float)Math.Sqrt(Human.GroundFriction);
                }

                SawEffect.Angle += GetFacingVector(Human.Facing).X * 10;

                var hitmask = RectangleF.Centered(Position, new Vector2(16, 16));
                //new RectangleDebug(Human.World, hitmask, Color.Red, 10);
                Human.SwingWeapon(hitmask, 10);
                Human.Velocity.X *= 0.75f;
                break;

            case (SawState.WindDown):
                WindDownTime    += delta * 0.25f;
                Pitch            = 1 - WindDownTime.Slide;
                SawEffect.Angle += (GetFacingVector(Human.Facing).X * 10) - WindDownTime.Slide;
                if (WindDownTime.Done)
                {
                    Human.ResetState();
                }
                break;
            }
        }