private void Awake() { State = (CheckIfTheIngredientsInInventoryAreCompatible()) ? CookingStationState.AVAILABLE : CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER; _CookingStationUI = GetComponentInChildren <CookingStationUI>(); _Animator = GetComponent <Animator>(); _Clock = GetComponentInChildren <CircularProgressbar>(true); }
protected IEnumerator CooldownDelay(float cooldownTime) { yield return(new WaitForSeconds(cooldownTime)); State = (CheckIfTheIngredientsInInventoryAreCompatible()) ? CookingStationState.AVAILABLE : CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER; _CookingStationUI.UpdateUI(); _StationIsAvailableEvent.Invoke(); }
private void OnIngredientModified(object data) { // Disabling if there are no compatible ingredients if (State != CookingStationState.AVAILABLE && State != CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER) { return; } State = (CheckIfTheIngredientsInInventoryAreCompatible()) ? CookingStationState.AVAILABLE : CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER; _CookingStationUI.UpdateUI(); }
protected IEnumerator CookingDelay(float cookingTime, IngredientMinion minion) { yield return(new WaitForSeconds(cookingTime)); HideClock(); minion.GetCooked(); _CookedIngredient = minion.Tag; _IngredientCookedEvent.Invoke(null); _IngredientFinishedCookingEvent.Invoke(); State = CookingStationState.COOKED_FOOD_AVAILABLE; _CookingStationUI.UpdateUI(); }
public bool Use(IngredientMinion minion) { if (State != CookingStationState.AVAILABLE && State != CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER) { return(false); } State = CookingStationState.COOKING; _CookingStationUI.UpdateUI(); _StationInUseEvent.Invoke(); _IngredientStartedToCook.Invoke(null); ShowClock(); StartCoroutine(CookingDelay(_CookingTime, minion)); return(true); }
private void OnCollectedIngredient(object data) { SO_UIMinionSlot slot = (SO_UIMinionSlot)data; if (State == CookingStationState.AVAILABLE || State == CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER) { if (CheckIfTheIngredientsInInventoryAreCompatible()) { State = CookingStationState.AVAILABLE; _CompatibleIngredientCollectedEvent.Invoke(); } else { State = CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER; } } _CookingStationUI.UpdateUI(); }
protected void OnPickedUpCookedFood(int playerWhoPickedUp, bool isLocalPlayer) { State = CookingStationState.COOLDOWN; _CookingStationUI.UpdateUI(); // Invoking Events if (IngredientPickedUpEvent != null) { IngredientPickedUpEvent.Invoke(playerWhoPickedUp, _CookedIngredient, CookingStepPerformed); } if (isLocalPlayer) { OnLocalPlayerCollectedCookedFood(_CookedIngredient); } StationInCoolDownEvent.Invoke(); StartCoroutine(CooldownDelay(CooldownTime)); }