public void UpdateData(IHasCooldown cd) { if (ReferenceEquals(cd, null)) { ClearCooldownData(); return; } var newData = cdSystem.GetCooldown(cd.Id); var curDataNotNull = !ReferenceEquals(data, null); var sameData = curDataNotNull && ReferenceEquals(data, newData); if (sameData) { return; } data?.RemoveListenAction(UpdateDisplay); id = cd.Id; data = newData; data?.AddListenAction(UpdateDisplay); }
private void InitTimer() { castingTimeWait = new WaitForSeconds(timeToCast); cd = cooldownSys.GetCooldown(Id); }