Пример #1
0
        public Cooldown(ActionManager actionManager, Action action)
        {
            this.actionManager = actionManager;
            this.action        = action;

            cooldownStruct = new CooldownStruct()
            {
                ActionID = this.ActionID, CooldownElapsed = 0, CooldownTotal = 0, IsCooldown = false
            };
            readyStopwatch.Start();
            Update();

            Task.Run(() => {
                if (action.Icon > 0 && action.IsPlayerAction)
                {
                    ActionIconTexture = actionManager.GetActionIcon(action);
                }
            });
        }
Пример #2
0
        public void Update()
        {
            var before = cooldownStruct.IsCooldown;

            if (action.CooldownGroup > 0)
            {
                var cooldownPtr = actionManager.GetCooldownPointer(action.CooldownGroup);
                cooldownStruct = Marshal.PtrToStructure <CooldownStruct>(cooldownPtr);
            }
            else
            {
                cooldownStruct = new CooldownStruct()
                {
                    ActionID = this.ActionID, CooldownElapsed = 0, CooldownTotal = 0, IsCooldown = false
                };
            }

            if (before && !cooldownStruct.IsCooldown)
            {
                readyStopwatch.Restart();
            }
        }