public void Watch(EntryType entryType, string path = null)
        {
            var target = new WatchTarget(entryType, path ?? WorkingDirectory);

            Watcher.Watch(target);
            Log.Debug($"watcher watch {target}");
        }
        public void Watch(EntryType entryType, string path = null)
        {
            var target = new WatchTarget(entryType, path ?? WorkingDirectory);

            Mirror.Watch(target);
            Mirror.RunAsync();

            Log.Debug($"mirror watch {target}");
        }
Beispiel #3
0
        public IWatchTarget Watch <T>(Monitor <T> monitor, Handler <T> onChange)   //adds a monitor to the list of observees
        {
            WatchTarget <T> observee = new WatchTarget <T>()
            {
                State   = monitor(),
                Eval    = monitor,
                Handler = onChange
            };

            _targets.Add(observee);
            return(observee);
        }
Beispiel #4
0
        /// <summary>
        /// Executed in every update if State is Chasing
        /// </summary>
        protected virtual void UpdateChasing()
        {
            if (WatchTarget == null)
            {
                return;
            }

            if (WatchTargetDistance < AttackDistance)
            {
                State = NpcState.Attack;
            }

            if ((lastUpdateTime + updateInterval) > Time.time)
            {
                return;
            }

            if (targetAtUpdate == null || WatchTarget.DistanceTo(targetAtUpdate.Value) < updateDistance) //did our target move enough
            {
                return;
            }

            MoveToTarget(WatchTarget.position);
        }
 public void Watch(WatchTarget target) => _mirror.Watch(target);