public IEnumerator Cook() { float journey = 0f; while (journey <= duration) { journey += Time.deltaTime; percentCooked = Mathf.Clamp01(journey / duration); ingCookValue = Mathf.Lerp(0, 1.0f, percentCooked); if (ingCookValue > 0.99f) { stateIngredient = StateIngredient.cooked; } yield return(null); } }
private void OnEnable() { stateIngredient = StateIngredient.raw; }