void InvokeFire(RotationEventArgs e) { if (Fire != null) { Fire(this, e); } }
void InvokeYaw180(RotationEventArgs e) { if (Yaw180 != null) { Yaw180(this, e); } }
void InvokeResetPosition(RotationEventArgs e) { if (ResetPosition != null) { ResetPosition(this, e); } }
public void CheckConditionsAndFire(RotationEventArgs e, bool ignoreConditions = false) { if (ConditionsAreTrue(e) || ignoreConditions) { InvokeFire(e); FireCountSinceLastResetPos++; } }
/// <summary> /// true when all the properties of the condition return true when compared to the rotation event /// </summary> /// <param name="e"></param> /// <returns></returns> public bool IsTrue(RotationEventArgs e) { if (ParentTrigger.TriggeringEvent != YawTrackerOrientationEvent.ResetPosition) { if (CompOperator == CompareOperator.Equal) { if (e.HalfTurns != TargetHalfTurns) { return(false); } } else if (CompOperator == CompareOperator.EqualOrGreaterThan) { if (e.HalfTurns < TargetHalfTurns) { return(false); } if (e.HalfTurns > TargetHalfTurnsMax) { return(false); } } if (TargetRotationSide != Direction.Either && e.RotationSide != TargetRotationSide) { return(false); } if (TargetAccumulation != AccumulationStatus.Either && e.RotationAccumulationStatus != TargetAccumulation) { return(false); } } else { if (e.PeakHalfTurns < TargetPeakHalfTurns) { return(false); } } return(true); }
/// <summary> /// true when all the properties of the condition return true when compared to the rotation event /// </summary> /// <param name="e"></param> /// <returns></returns> public bool IsTrue(RotationEventArgs e) { if (CompOperator == CompareOperator.Equal) { if (e.HalfTurns != TargetHalfTurns) { return(false); } } else if (CompOperator == CompareOperator.EqualOrGreaterThan) { if (e.HalfTurns < TargetHalfTurns) { return(false); } } if (e.HalfTurns > TargetHalfTurnsMax) { return(false); } if (TargetRotationSide != Direction.Either && e.RotationSide != TargetRotationSide) { return(false); } if (TargetAccumulation != AccumulationStatus.Either && e.RotationAccumulationStatus != TargetAccumulation) { return(false); } if (e.PeakHalfTurns < TargetPeakHalfTurns) { return(false); } return(true); }
protected bool ConditionsAreTrue(RotationEventArgs e) { if (FireLimitPerReset > 0 && FireCountSinceLastResetPos >= FireLimitPerReset) { return(false); } if (RotCondition != null) { if (RotCondition.IsTrue(e) == false) { return(false); } } // further conditions... return(true); }
void OnTriggerFire(Object sender, RotationEventArgs e) { TheAction?.Run(); }
void OnResetPosition(object sender, RotationEventArgs e) { FireCountSinceLastResetPos = 0; }
void OnTriggeringTrackerEvent(object sender, RotationEventArgs e) { CheckConditionsAndFire(e); }
void InvokeYaw180(RotationEventArgs e) { Yaw180?.Invoke(this, e); }
void InvokeResetPosition(RotationEventArgs e) { ResetPosition?.Invoke(this, e); }
void InvokeFire(RotationEventArgs e) { Fire?.Invoke(this, e); }