public void TurnOn(double lengthSeconds) { if (IsDesignTime) { return; } if (lengthSeconds <= 0) { this.TurnOff(); return; } Logger.Info("Cooldown started: " + lengthSeconds + " seconds"); this.ResetLastProgressFraction(); this.totalDurationSeconds = lengthSeconds; this.timeRemainsSeconds = lengthSeconds; if (!this.isTurnedOn) { this.isTurnedOn = true; this.IsVisible = true; this.componentCooldownIndicatorUpdater = Client.Scene.CreateSceneObject("Cooldown scene object") .AddComponent <ClientComponentCooldownIndicator>(); this.componentCooldownIndicatorUpdater.ViewModelToUpdate = this; } this.Update(0); }
public void TurnOff() { if (IsDesignTime) { return; } if (this.isTurnedOn) { this.isTurnedOn = false; Logger.Info("Cooldown turn off!"); this.componentCooldownIndicatorUpdater.SceneObject.Destroy(); this.componentCooldownIndicatorUpdater = null; } this.IsVisible = false; }