public Cooldown(AbstractAttacker sender, CooldownTypes type, int span) { Owner = sender; Type = type; Span = span; Created = DateTime.Now; }
public bool Exists(AbstractAttacker sender, CooldownTypes cooldownType) { if (sender == null) { return(false); } return(ServerController.Get <CooldownController>().Exists(sender, cooldownType)); }
/// <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)); }
/// <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)); }
/// <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); }
private Cooldown(AbstractAttacker sender, CooldownTypes type, int span, Action onStartAction, Action onFinishAction) : this(sender, type, span, onFinishAction) { OnStartAction = onStartAction; }
public Cooldown(AbstractAttacker sender, CooldownTypes type, int span, Action onCooldownFinish) : this(sender, type, span) { OnCompleteAction = onCooldownFinish; }