示例#1
0
 public CooldownController(MonoBehaviour main, TimeSpan time, bool cooldownOnStart = false)
 {
     stoper = new AsyncStoper(main, time);
     if (cooldownOnStart)
     {
         Reset();
     }
 }
        public static void MakeSimple(MonoBehaviour main, TimeSpan time, EventHandler <EventArgs> @event)
        {
            AsyncStoperList.Add(new AsyncStoper(main, time, @event));
            AsyncStoper stoper = AsyncStoperList[AsyncStoperList.Count - 1];

            stoper.OnEnd += AsyncStoper_OnEnd;
            stoper.Start();
        }
示例#3
0
 protected override void Awake()
 {
     stoper = new AsyncStoper(this, delay.TimeSpan)
     {
         AutoReset = autoReset
     };
     stoper.OnEnd += (s, e) => onTimeOver.Invoke();
     if (activeOnStart)
     {
         stoper.Start();
     }
 }
示例#4
0
 protected new void Awake()
 {
     base.Awake();
     stoper = new AsyncStoper(this, TimeSpan.FromSeconds(secondClickDelay), (s, e) => firstClick = false);
 }
        private static void AsyncStoper_OnEnd(object sender, EventArgs e)
        {
            AsyncStoper asyncStoper = sender as AsyncStoper;

            AsyncStoperList.Remove(asyncStoper);
        }