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