Exemple #1
0
    public void Update(int dt)
    {
        foreach (KeyValuePair <int, TimerItem> pair in this.timer_map)
        {
            int       timer_idx  = pair.Key;
            TimerItem timer_item = pair.Value;
            if (timer_item.Update(dt))
            {
                if (!timer_item.IsLoop())
                {
                    this.timer_map.Remove(timer_idx);
                }
                TimerAction action = timer_item.GetAction();
                object      data   = timer_item.GetData();

                try
                {
                    action(data);
                }
                catch
                {
                }
            }
        }
    }