Esempio n. 1
0
        public bool Resolve()
        {
            var ent    = EntityManager.GetEntiy <GameObject>(EntID);
            var valCom = ent.GetComponent <IValueCom <T> >(ToWatchAlais);

            return(Triggers.All(i => i.Resolve(valCom.Value)));
        }
Esempio n. 2
0
 /// <summary>
 /// Determines whether the specified <see cref="System.Object"/>, is equal to this instance.
 /// </summary>
 /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance;
 /// otherwise, <c>false</c>.
 /// </returns>
 public override bool Equals(object obj)
 {
     return((obj is Table Item) &&
            Columns.All(x => Item.Columns.Contains(x)) &&
            Name == Item.Name &&
            Constraints.All(x => Item.Constraints.Contains(x)) &&
            Triggers.All(x => Item.Triggers.Contains(x)));
 }
Esempio n. 3
0
        protected override IObservable <float> Observe(IObservable <long> onTick)
        {
            var source = onTick
                         .Where(_ => Triggers.All(t => t.Up))
                         .Throttle(TimeSpan.FromSeconds(0.25));

            return(source
                   .Buffer(source)
                   .Where(xs => xs.Count > 1)
                   .Select(xs => (float)xs.Count));
        }
Esempio n. 4
0
        // Fire and forget
        public async Task CheckAndExecute(IEnumerable <Job> jobs)
        {
            var job = jobs.FirstOrDefault(j => j.Id == JobId);

            if (job == null)
            {
                return;
            }

            try
            {
                // Check the status of triggers on the current job
                if (Triggers.All(t => t.CheckStatus(job)))
                {
                    Executions++;
                    IsExecuting = true;

                    foreach (var action in Actions)
                    {
                        // Try to execute action on current job or any of the other jobs
                        try
                        {
                            await action.Execute(JobId, jobs);
                        }
                        catch
                        {
                            // Something went bad with actions
                        }
                    }
                }
            }
            catch
            {
                // Something went bad with triggers (maybe the job isn't there anymore)
            }
            finally
            {
                IsExecuting = false;
            }
        }
Esempio n. 5
0
 public bool HaveAllTriggersFired()
 {
     return(Triggers.All(trigger => trigger.HasFired(_triggerParameters)));
 }
Esempio n. 6
0
 protected override IObservable <float> Observe(IObservable <long> onTick)
 {
     return(onTick.Where(_ => Triggers.All(t => t.Down)).Select(_ => 1f));
 }
Esempio n. 7
0
 protected override IObservable <float> Observe(IObservable <long> onTick)
 {
     return(onTick
            .Select(_ => Triggers.All(t => t.Hold))
            .Select(state => state ? 1f : 0f));
 }