/// <summary> /// Renders the target slice /// </summary> /// <param name="targetSlice">Target slice</param> public void RenderSlice(PizzaSlice targetSlice) { for (int i = 0; i < this.Toppings.Count; i++) { this.Toppings[i].gameObject.SetActive(targetSlice.Toppings.Contains((Topping)i)); } this.PizzaBase.gameObject.SetActive(targetSlice.IsReady); if (!targetSlice.IsReady) { this.CooldownText.WatchSlice(targetSlice); } }
/// <summary> /// Called once per frame /// </summary> protected void Update() { if (this.watchingSlice != null) { var timeLeft = this.watchingSlice.BakeTimeLeft; if (timeLeft <= 0) { this.watchingSlice = null; this.gameObject.SetActive(false); return; } this.textComponent.text = this.watchingSlice.BakeTimeLeft.ToString("0.0"); } }
/// <summary> /// Watches the slice /// </summary> /// <param name="slice">Target slice</param> public void WatchSlice(PizzaSlice slice) { this.watchingSlice = slice; this.gameObject.SetActive(true); }