Beispiel #1
0
 void InvokeFire(RotationEventArgs e)
 {
     if (Fire != null)
     {
         Fire(this, e);
     }
 }
Beispiel #2
0
 void InvokeYaw180(RotationEventArgs e)
 {
     if (Yaw180 != null)
     {
         Yaw180(this, e);
     }
 }
Beispiel #3
0
 void InvokeResetPosition(RotationEventArgs e)
 {
     if (ResetPosition != null)
     {
         ResetPosition(this, e);
     }
 }
Beispiel #4
0
 public void CheckConditionsAndFire(RotationEventArgs e, bool ignoreConditions = false)
 {
     if (ConditionsAreTrue(e) || ignoreConditions)
     {
         InvokeFire(e);
         FireCountSinceLastResetPos++;
     }
 }
Beispiel #5
0
        /// <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);
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
 void OnTriggerFire(Object sender, RotationEventArgs e)
 {
     TheAction?.Run();
 }
Beispiel #9
0
 void OnResetPosition(object sender, RotationEventArgs e)
 {
     FireCountSinceLastResetPos = 0;
 }
Beispiel #10
0
 void OnTriggeringTrackerEvent(object sender, RotationEventArgs e)
 {
     CheckConditionsAndFire(e);
 }
Beispiel #11
0
 void InvokeYaw180(RotationEventArgs e)
 {
     Yaw180?.Invoke(this, e);
 }
Beispiel #12
0
 void InvokeResetPosition(RotationEventArgs e)
 {
     ResetPosition?.Invoke(this, e);
 }
Beispiel #13
0
 void InvokeFire(RotationEventArgs e)
 {
     Fire?.Invoke(this, e);
 }