예제 #1
0
        /// <summary>
        /// If this entity uses the given subject, add a <see cref="UsedByInfo"/> entry to
        /// the given result.
        /// </summary>
        public override void CollectUsageInfo(IEntity subject, UsedByInfos results)
        {
            base.CollectUsageInfo(subject, results);
            if (subject == From)
            {
                results.UsedBy(this, Strings.UsedByRouteAsFrom);
            }
            if (subject == To)
            {
                results.UsedBy(this, Strings.UsedByRouteAsTo);
            }
            if (crossingJunctions.Contains(subject as IJunction))
            {
                results.UsedBy(this, Strings.UsedByRouteAsCrossingJunction);
            }
            var @event = events.FirstOrDefault(x => x.Sensor == subject);

            if (@event != null)
            {
                if (@event.Behaviors.Any(x => x.StateBehavior == RouteStateBehavior.Enter))
                {
                    results.UsedBy(this, Strings.UsedByRouteAsEnteringSensor);
                }
                if (@event.Behaviors.Any(x => x.StateBehavior == RouteStateBehavior.Reached))
                {
                    results.UsedBy(this, Strings.UsedByRouteAsReachedSensor);
                }
                if (@event.Behaviors.Any(x => (x.StateBehavior != RouteStateBehavior.Reached) && (x.StateBehavior != RouteStateBehavior.Enter)))
                {
                    results.UsedBy(this, Strings.UsedByRouteAsOtherSensor);
                }
            }
            permissions.CollectUsageInfo(subject, results);
            enteringDestinationTrigger.CollectUsageInfo(subject, results);
            destinationReachedTrigger.CollectUsageInfo(subject, results);
        }
예제 #2
0
 /// <summary>
 /// If this entity uses the given subject, add a <see cref="UsedByInfo"/> entry to
 /// the given result.
 /// </summary>
 public override void CollectUsageInfo(IEntity subject, UsedByInfos results)
 {
     base.CollectUsageInfo(subject, results);
     activateTrigger.CollectUsageInfo(subject, results);
     deActivateTrigger.CollectUsageInfo(subject, results);
 }