예제 #1
0
    void feedDogs(DogFoodData food)
    {
        int amountFoodNeeded = calculateDogFoodNeeded();

        if (amountFoodNeeded <= k.NONE_VALUE)
        {
            return;
        }
        DogFoodData foodNeeded = food.Copy();

        foodNeeded.SetAmount(-amountFoodNeeded);
        if (dataController.HasFood(food.FoodType, amountFoodNeeded) && !IsCurrentlyFeeding)
        {
            dataController.ChangeCurrencyAmount(foodNeeded);
            buttonReference.interactable = false;
            EventController.Event(k.GetPlayEvent(k.ADD_FOOD));
            dataController.RefillDogFood();
            giveDogsFood(foodNeeded);
            foodBowlImage.color = food.Color;
            currentFood         = foodNeeded;
            feedingTimer.Reset();
            feedingTimer.Begin();
            foodSelector.Hide();
        }
        else
        {
            EventController.Event(k.GetPlayEvent(k.EMPTY));
            foodSelector.SetDescription(LanguageDatabase.GetInstance.GetTerm(k.BUY_MORE_FOOD));
            foodSelector.SetDelegate(loadFoodShop);
        }
    }
예제 #2
0
 public bool TrySendToScout()
 {
     if (!IsScouting && HasScoutingTimer)
     {
         descriptor.HandleScoutingBegan(gameController.GetCurrentSlotIndex());
         scoutingTimer.Begin();
         int  slotIndex;
         bool wasSuccess = gameController.TrySendDogToScout(this, out slotIndex);
         if (wasSuccess)
         {
             analytics.SendEvent(
                 new DogAnalyticsEvent(
                     DogAnalyticsEvent.DOG_SEND_TO_SCOUT,
                     this.descriptor));
         }
         else
         {
             descriptor.HandleScoutingEnded();
         }
         return(wasSuccess);
     }
     else
     {
         return(false);
     }
 }
예제 #3
0
 void resetAndBeginGiftTimer()
 {
     collectGiftButton.ToggleInteractable(false);
     collectGiftButton.TryUnsubscribeAll();
     (dailyGiftTimer as ISubscribable).TryUnsubscribeAll();
     dailyGiftTimer.SubscribeToTimeChange(handleDailyGiftCountDownChange);
     dailyGiftTimer.SubscribeToTimeUp(makeDailyGiftAvailableToRedeem);
     dataController.StartDailyGiftCountdown(dailyGiftTimer);
     dailyGiftTimer.Begin();
 }
예제 #4
0
 public void BeginTimer()
 {
     timer.Begin();
 }