void OnFanReachedEnd() { lastUsedPit.Fan(0); waitingForFanReachedEnd = false; lastUsedPit = null; isFanning = false; }
void OnFanRequested(FirePit pit) { if (!isInFanMode) { if (!IsWaitingForFan()) { StartFanMode(); } return; } float fanTime = Mathf.Clamp(fanAnimationState.normalizedTime, 0, 1.0f); int fanPower = 0; if (isFanning) { if (fanTime < lessThanFailThreshold) { return; } // else if (fanTime >= moreThanFailThreshold) // { // isFanning = false; // } else { if (fanTime > moreThanPerfectThreshold) { fanPower = perfectFanAmount; } else { fanPower = mediumFanAmount; } fanDirectionIsUp = !fanDirectionIsUp; } } if (!isFanning) { if (fanTime == 1.0f) { fanDirectionIsUp = !fanDirectionIsUp; isFanning = true; } else { return; } } if (fanDirectionIsUp) { StartAnimationAt(fanUp, birchUp, 1.0f - fanTime); } else { StartAnimationAt(fanDown, birchDown, 1.0f - fanTime); } waitingForFanReachedEnd = true; lastUsedPit = pit; if (fanPower != 0) { pit.Fan(fanPower); } }