public override void UpdateDelta(float delta) { switch (State) { case (SwingAction.Start): if (StartTime - delta <= 0) { State = SwingAction.Swing; } break; case (SwingAction.Swing): if (SwingTime - delta <= 0) { State = SwingAction.End; } break; case (SwingAction.End): if (EndTime - delta <= 0) { Human.ResetState(); } break; } }
public void Fire() { SlashAction = SwingAction.DownSwing; Human.UpdatePose(); var direction = TargetOffset; direction.Normalize(); Weapon.Shoot(Human, FirePosition, direction); }
public virtual void Swing() { Vector2 WeaponSize = new Vector2(16, 24) * Weapon.LengthModifier; RectangleF weaponMask = RectangleF.Centered(Human.Position + new Vector2(Human.Facing.GetX() * 0.5f * WeaponSize.X, 0), WeaponSize); if (Human.Weapon.CanParry) { Vector2 parrySize = new Vector2(22, 22); bool success = Human.Parry(weaponMask); if (success) { Parried = true; } } if (!Parried) { Human.SwingWeapon(weaponMask, 10); SwingVisual(Parried); SlashAction = SwingAction.DownSwing; } }
public virtual void Swing() { float sizeMult = 1; Vector2 weaponSize = new Vector2(16, 8); weaponSize.X *= Weapon.LengthModifier; weaponSize.Y *= Weapon.WidthModifier; RectangleF weaponMask = new RectangleF(Human.Position + GetFacingVector(Human.Facing) * 8 + GetFacingVector(Human.Facing) * (weaponSize.X / 2) + new Vector2(0, 1) - weaponSize / 2f, weaponSize); /* * Vector2 PlayerWeaponOffset = Position + FacingVector * 14; * Vector2 WeaponSize = new Vector2(14 / 2, 14 * 2); * RectangleF weaponMask = new RectangleF(PlayerWeaponOffset - WeaponSize / 2, WeaponSize);*/ if (Weapon.CanParry) { HorizontalFacing Facing = Human.Facing; Vector2 Position = Human.Position; Vector2 FacingVector = GetFacingVector(Facing); Vector2 parrySize = new Vector2(22, 22); bool success = Human.Parry(new RectangleF(Position + FacingVector * 8 - parrySize / 2, parrySize)); if (success) { Parried = true; } } if (!Parried) { Human.SwingWeapon(weaponMask, 10); SwingVisual(Parried); SlashAction = SwingAction.DownSwing; } }
public override void UpdateDelta(float delta) { switch (SlashAction) { case (SwingAction.StartSwing): SlashStartTime -= delta; if (SlashStartTime < 0) { SlashAction = SwingAction.UpSwing; } break; case (SwingAction.UpSwing): SlashUpTime -= delta; if (SlashUpTime < 0) { Swing(); } break; case (SwingAction.DownSwing): SlashDownTime -= delta; if (SlashDownTime < 0) { SlashAction = SwingAction.FinishSwing; } break; case (SwingAction.FinishSwing): SlashFinishTime -= delta; if (SlashFinishTime < 0) { Human.ResetState(); } break; } }
public override void ParryReceive(IParryGiver giver) { SwingVisual(Parried); SlashAction = SwingAction.DownSwing; }