Esempio n. 1
0
        public static ITriggerAction <T> Timeout <T>(this ITriggerAction <T> self, float time, bool realtime = false)
        {
            Trigger <T> trigger = new Trigger <T>(oneShot: self.OneShot);

            self.Add(trigger);
            var timeout = realtime ? TriggerBehaviour.Realtime(time) : TriggerBehaviour.Time(time);

            timeout.Add(ret =>
            {
                if (!trigger.Action.Fired)
                {
                    trigger.Error(new TimeoutException("trigger timeout"));
                }
            });
            return(trigger.Action);
        }
Esempio n. 2
0
        public static ITriggerAction <T> Realtime <T>(this ITriggerAction <T> self, float time)
        {
            Trigger <T> trigger = new Trigger <T>(oneShot: self.OneShot);

            self.Add((item, ex) =>
            {
                if (ex != null)
                {
                    trigger.Error(ex);
                }
                else
                {
                    TriggerBehaviour.Realtime(time)
                    .Add(x => trigger.Fire(item))
                    .AddFail(trigger.Error);
                }
            });
            return(trigger.Action);
        }
Esempio n. 3
0
 public static ITriggerAction <bool> Realtime(float time)
 {
     return(TriggerBehaviour.Realtime(time));
 }