Example #1
0
 private void Awake()
 {
     State             = (CheckIfTheIngredientsInInventoryAreCompatible()) ? CookingStationState.AVAILABLE : CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER;
     _CookingStationUI = GetComponentInChildren <CookingStationUI>();
     _Animator         = GetComponent <Animator>();
     _Clock            = GetComponentInChildren <CircularProgressbar>(true);
 }
Example #2
0
    protected IEnumerator CooldownDelay(float cooldownTime)
    {
        yield return(new WaitForSeconds(cooldownTime));

        State = (CheckIfTheIngredientsInInventoryAreCompatible()) ? CookingStationState.AVAILABLE : CookingStationState.NOT_VISIBLE_TO_LOCAL_PLAYER;
        _CookingStationUI.UpdateUI();
        _StationIsAvailableEvent.Invoke();
    }
Example #3
0
 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();
 }
Example #4
0
    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();
    }
Example #5
0
    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);
    }
Example #6
0
    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();
    }
Example #7
0
    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));
    }