Exemplo n.º 1
0
 public Cooldown(AbstractAttacker sender, CooldownTypes type, int span)
 {
     Owner   = sender;
     Type    = type;
     Span    = span;
     Created = DateTime.Now;
 }
Exemplo n.º 2
0
        public bool Exists(AbstractAttacker sender, CooldownTypes cooldownType)
        {
            if (sender == null)
            {
                return(false);
            }

            return(ServerController.Get <CooldownController>().Exists(sender, cooldownType));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Getting the cooldown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="cooldownType"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public Cooldown Get(AbstractAttacker sender, CooldownTypes cooldownType)
        {
            if (sender == null)
            {
                Out.QuickLog("Something went wrong while getting the cooldown", LogKeys.ERROR_LOG);
                throw new Exception("Sender is null, something went wrong while getting cooldown");
            }

            return(_cooldowns.FirstOrDefault(x => x.Owner == sender && x.Type == cooldownType));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Checking if it exists
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="cooldownType"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public bool Exists(AbstractAttacker sender, CooldownTypes cooldownType)
        {
            if (sender == null)
            {
                Out.QuickLog("Something went wrong while checking the cooldown", LogKeys.ERROR_LOG);
                throw new Exception("Sender is null, something went wrong while checking cooldown");
            }

            return(_cooldowns.Any(x => x.Owner == sender && x.Type == cooldownType));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Getting the cooldown
        /// </summary>
        /// <param name="sender">Person who needs to have the cooldown</param>
        /// <param name="type">Type of cooldown</param>
        /// <returns>Cooldown</returns>
        /// <exception cref="Exception">Sender is invalid</exception>
        /// <exception cref="NullReferenceException">Cooldown is not found</exception>
        public Cooldown Get(AbstractAttacker sender, CooldownTypes type)
        {
            if (sender == null)
            {
                Out.QuickLog("Something is wrong with CooldownManager's sender on Get", LogKeys.ERROR_LOG);
                throw new Exception("Something is wrong with sender");
            }

            var cooldown = ServerController.Get <CooldownController>().Get(sender, type);

            if (cooldown == null)
            {
                Out.QuickLog("Failed getting a cooldown from type " + type, LogKeys.ERROR_LOG);
                throw new NullReferenceException("Cooldown is null, failed getting");
            }
            return(cooldown);
        }
Exemplo n.º 6
0
 private Cooldown(AbstractAttacker sender, CooldownTypes type, int span, Action onStartAction, Action onFinishAction) :
     this(sender, type, span, onFinishAction)
 {
     OnStartAction = onStartAction;
 }
Exemplo n.º 7
0
 public Cooldown(AbstractAttacker sender, CooldownTypes type, int span, Action onCooldownFinish) : this(sender, type, span)
 {
     OnCompleteAction = onCooldownFinish;
 }