Example #1
0
        public static Cooldown Create(CooldownType type, uint id, float cdTime)
        {
            GameObject go = new GameObject("Cooldown");

            go.hideFlags = HideFlags.HideAndDontSave;
            Cooldown cooldown = go.AddComponent <Cooldown>();

            cooldown.type      = type;
            cooldown.id        = id;
            cooldown.cdTime    = cdTime;
            cooldown.startTime = Time.realtimeSinceStartup;
            return(cooldown);
        }
Example #2
0
        public void AddCooldown(CooldownType type, uint id, float cdTime)
        {
            Cooldown cool = GetCooldown(type, id);

            if (cool != null)
            {
                cool.Dispose();
            }
            cool = Cooldown.Create(type, id, cdTime);
            string key = type.ToString() + id;

            cooldownDict[key] = cool;
            if (OnCooldownChange != null)
            {
                OnCooldownChange(cool);
            }
        }