Exemple #1
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;
            }
        }
        public void TestParryEffect()
        {
            ParryEffect NewEffect = (ParryEffect)DummyMap.DicEffect[ParryEffect.Name].Copy();

            NewEffect.Attacks.Add("Test");

            BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[PassiveRequirement.Name].Copy(),
                                                             DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(),
                                                             NewEffect);

            Squad DummySquad = CreateDummySquad();

            GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, null);

            Assert.AreEqual(0, GlobalDeathmatchContext.EffectOwnerUnit.Boosts.ParryModifier.Count);

            DummySkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual("Test", GlobalDeathmatchContext.EffectOwnerUnit.Boosts.ParryModifier[0]);
        }