public void Update(float dt) { if (timeCooldown == null) { if (timeCooldowns.Count > 0) { timeCooldown = timeCooldowns.Dequeue(); } } if (timeCooldown != null) { if (adjust) { adjust = false; timeCooldown.AdjustRemainingWithRatio(ratio); } timeCooldown.Update(dt); if (timeCooldown.IsComplete()) { currentCharge++; //DLog.Log("Recover charge, current: " + currentCharge); timeCooldown = null; } } }
public void Start() { if (IsRecastable()) { if (timeCooldown != null) { timeCooldown.ConsumeRecast(); } return; } currentCharge--; //DLog.Log("Current charge: " + currentCharge); TimeCooldown cooldown = new TimeCooldown(Duration()); timeCooldowns.Enqueue(cooldown); cooldown.Start(); }
public TimeCooldownResource(float duration) { timeCooldown = new TimeCooldown(duration); }
public TimeCooldownResource(float duration, float scale = 1) { timeCooldown = new TimeCooldown(duration, scale); }