public override bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner) { if (!IsShootingNext) { if (_IsShooting) { IsShootingNext = CurrentAnimation.ActiveKeyFrame >= CurrentAnimation.LoopEnd - 1; if (InstantActivation) { InitiateFollowingAttack(AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); return(true); } } //First use of a combo, use it immediatly. else { IsShootingNext = true; _IsShooting = true; InitiateFollowingAttack(AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); return(true); } } return(false); }
public override bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner) { //Only get the next combo if it is not set to avoid overriding it. if (NextCombo == null) { // Already using a combo, fetch the next combo. if (ActiveCombo != null) { NextCombo = ActiveCombo.GetNextCombo(AttackInput, CurrentMovementInput, gameTime, ForceCombo, Owner); if (NextCombo != null && NextCombo.InstantActivation) { InitiateFollowingAttack(NextCombo.AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); } } //First use of a combo, use it immediatly. else { Combo ActiveWeaponCombo = GetActiveWeaponCombo(ActiveMovementStance); if (ActiveWeaponCombo != null) { NextCombo = ActiveWeaponCombo.GetNextCombo(AttackInput, CurrentMovementInput, gameTime, ForceCombo, Owner); if (NextCombo != null) { ActiveCombo = ActiveWeaponCombo; InitiateFollowingAttack(NextCombo.AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); return(true); } } } } return(false); }
public void InitiateAttack(GameTime gameTime, AttackInputs AttackInput) { foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons) { if (ActiveWeapon.InitiateAttack(gameTime, AttackInput, CurrentMovementInput, ActiveMovementStance, false, this)) { break; } } }
public void Execute(Entity entity, int index, [ReadOnly] ref MoveToTarget target, [ReadOnly] ref Character character, [ReadOnly] ref Translation pos) { Entity meleeWeaponEntity = character.ActiveMeleeWeaponEntity; AttackInputs myAttackInput = AttackInputsGroup[meleeWeaponEntity]; if (target.TargetEntity != Entity.Null && meleeWeaponEntity != Entity.Null && math.distancesq(target.TargetPosition, pos.Value) < MeleeWeaponGroup[meleeWeaponEntity].AttackRangeSqr) { // set inputs myAttackInput.AttackHeld = true; } else { myAttackInput.AttackHeld = false; } AttackInputsGroup[meleeWeaponEntity] = myAttackInput; }
public InputChoice(AttackInputs AttackInput, MovementInputs MovementInput) { this.AttackInput = AttackInput; this.MovementInput = MovementInput; NextInputDelay = 0; }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="AttackInput"></param> /// <param name="ActiveWeapon"></param> /// <returns>Returns true if the attack was used.</returns> public abstract bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner);
public Combo GetNextCombo(AttackInputs CurrentAttackInput, MovementInputs CurrentMovementInput, GameTime gameTime, bool ForceCombo, RobotAnimation Owner) { for (int C = 0; C < ListNextCombo.Count; C++) { bool InputComplete = ForceCombo; InputChoice ActiveInputChoice = ListNextCombo[C].ListInputChoice[ListNextCombo[C].CurrentInputIndex]; bool AttackInputAccepted = false; if (ActiveInputChoice.AttackInput != AttackInputs.None && (ActiveInputChoice.AttackInput == AttackInputs.AnyHold || ActiveInputChoice.AttackInput == AttackInputs.AnyPress || ActiveInputChoice.AttackInput == CurrentAttackInput)) { AttackInputAccepted = true; } bool MovementInputAccepted = false; if (ActiveInputChoice.MovementInput == MovementInputs.Any || ActiveInputChoice.MovementInput == CurrentMovementInput) { MovementInputAccepted = true; } bool NextInputDelayAccepted = false; if (ActiveInputChoice.CurrentDelay >= ActiveInputChoice.NextInputDelay) { NextInputDelayAccepted = true; } else { ActiveInputChoice.CurrentDelay += gameTime.ElapsedGameTime.Milliseconds; } bool FrameLimitAccepted = false; int ComboKeyFrame = Owner.ActiveKeyFrame; if (AnimationType == AnimationTypes.PartialAnimation) { int a = Owner.GetPartialAnimationKeyFrame(AnimationName); if (a >= 0) { ComboKeyFrame = a; } } if (ComboKeyFrame >= ListStart[C] && ComboKeyFrame <= ListEnd[C]) { FrameLimitAccepted = true; } if (AttackInputAccepted && MovementInputAccepted && NextInputDelayAccepted && FrameLimitAccepted) { ListNextCombo[C].CurrentInputIndex++; if (ListNextCombo[C].CurrentInputIndex >= ListNextCombo[C].ListInputChoice.Count) { InputComplete = true; } } if (InputComplete) { ListNextCombo[C].Reset(); return(ListNextCombo[C]); } } return(null); }