Exemple #1
0
        private IEnumerator Tick()
        {
            var tick = new WaitForSeconds(2f);

            Durations = new Hashtable();
            while (IsAlive)
            {
                if (OnTick != null)
                {
                    var results = OnTick.GetInvocationList().Select(x =>
                    {
                        Durations[x] = x.DynamicInvoke(this, (int)Durations[x]);
                        return(x);
                    }).Where(x => (int)Durations[x] == 0);
                    foreach (var result in results)
                    {
                        Durations.Remove(result);
                        OnTick -= (TickEvent)result;
                    }
                }
                yield return(tick);
            }
        }