Esempio n. 1
0
    /// <summary>
    /// just the top type
    /// </summary>
    /// <returns></returns>
    public PetType CalculatePetType()
    {
        int berries = DataDump.Get <int>("LocalPetBerriesEaten");
        int cookies = DataDump.Get <int>("LocalPetCookiesEaten");
        int fish    = DataDump.Get <int>("LocalPetFishEaten");

        return(new[] {
Esempio n. 2
0
    public void Feed(int type)
    {
        CloseFoodMenu();
        Juicer.Instance.PlayEatSFX();
        int foodLeft = DataDump.Get <int>(((FoodType)type).ToString()) - 1;

        DataDump.Set <int>(((FoodType)type).ToString(), foodLeft);
        string dataName = $"LocalPet{((FoodType)type).ToString()}Eaten";
        int    petEaten = DataDump.Get <int>(dataName) + 1;

        DataDump.Set(dataName, petEaten);
        int fullness = DataDump.Get <int>("LocalPetFullness") + 1;

        DataDump.Set("LocalPetFullness", fullness);
        if (fullness > FullnessDeath)
        {
            // go to the die
            StartCoroutine(Die());
            return;
        }
        if (fullness > FullnessTolerance)
        {
            // play sick animation
        }
    }
Esempio n. 3
0
    public IEnumerator OnUpdate()
    {
        GameConductor.ResetPlayer();
        GameConductor.UnfreezePlayer();
        GameConductor.PerformScheduleCallbacks(11, 0);
        _daycard.SetActive(true);
        _daycard.GetComponentInChildren <Text>().text = DataDump.Get <string>("Day") + " evening";
        yield return(new WaitForSeconds(4));

        _daycard.SetActive(false);
        bool isFinished = false;

        ScreenFader.FadeInThen(() =>
        {
            GameConductor.FreezePlayer();
            MessageController.AddMessage("Hmm. Haven't seen you around before.", postAction: () => GameConductor.CameraStateTrigger("NextState"));
            MessageController.AddMessage("Welcome to The Deja Brew.");
            MessageController.AddMessage("... oh? You need a place to stay?");
            MessageController.AddMessage("We got a room in the back when you're ready to hit the hay.");
            MessageController.AddMessage("Literally -- it's all we got.", postAction: () =>
            {
                GameConductor.CameraStateTrigger("FocusPlayer");
                GameConductor.UnfreezePlayer();
                isFinished = true;
            });
            MessageController.AddMessage("Enjoy the band and meet some of the regulars. We usually get a few characters in here.");
        });
        do
        {
            yield return(new WaitForSeconds(1));
        } while (!isFinished);
    }
Esempio n. 4
0
 public void SetFoodMenu()
 {
     for (int i = 0; i <= 2; ++i)
     {
         var foodType = (FoodType)i;
         int amount   = DataDump.Get <int>(foodType.ToString());
         FoodButtons[i].SetActive(amount > 0);
     }
 }
Esempio n. 5
0
    public void TimeStep()
    {
        GrowthStage stage = (GrowthStage)DataDump.Get <int>("LocalPetGrowthStage");

        switch (stage)
        {
        case GrowthStage.Baby:
        case GrowthStage.Juvi:
            int fullness = DataDump.Get <int>("LocalPetFullness") - 1;
            if (fullness <= 0)
            {
                // go to the die
                StartCoroutine(Die());
                MessageController.AddMessage("oof");
                MessageController.AddMessage("it starved to death");
                MessageController.AddMessage("gather the food that's laying around");
                MessageController.AddMessage("make sure to click the pet");
                MessageController.AddMessage("and then the type of food");
                MessageController.AddMessage("it will be dead for a minute..");
                MessageController.AddMessage("but it always comes back");
                return;
            }
            if (fullness == FullnessTolerance / 2)
            {
                // go to the complain
                MessageController.AddMessage("it's getting hungry..");
            }
            if (fullness == 3)
            {
                // go to the complain
                MessageController.AddMessage("it's about to starve!");
            }
            DataDump.Set("LocalPetFullness", fullness);
            break;
        }

        if (stage == GrowthStage.Baby && DataDump.Get <int>("LocalPetNextGrowthTime") < CurrentTime)
        {
            // go to the grow
            StartCoroutine(Grow());
        }

        if (stage == GrowthStage.Dead && DataDump.Get <int>("LocalPetNextGrowthTime") < CurrentTime)
        {
            StartCoroutine(Sprout());
        }
    }
Esempio n. 6
0
    public void Pick()
    {
        if (currentAmount == 0)
        {
            OnFailedPick.Invoke(0);
            Juicer.Instance.PlayNaturalClip(OnFailClip);
            return;
        }

        if (!DataDump.Get <bool>(resourceName + "Discovered"))
        {
            DataDump.Set(resourceName + "Discovered", true);
        }
        DataDump.Set(resourceName, DataDump.Get <int>(resourceName) + currentAmount);
        OnPick.Invoke(currentAmount);
        currentAmount = 0;
        StartCoroutine(WaitToRegrow());
        Juicer.Instance.PlayNaturalClip(OnPickClip);
        Juicer.Instance.PlayPickSFX();
    }
Esempio n. 7
0
    public IEnumerator OnUpdate()
    {
        do
        {
            int currentHP = DataDump.Get <int>("HP") - 1;
            DataDump.Set("HP", currentHP);
            DataDump.Set("ScaledHP", (float)currentHP / maxHP);
            yield return(new WaitForSeconds(1));
        } while (DataDump.Get <int>("HP") > 0);
        Juicer.CreateFx(0, player.transform.position);
        GameObject.Destroy(player);
        Juicer.ShakeCamera(1.5f);
        bool readyToMoveOn = false;

        MessageController.AddMessage("butterboi is dead now.", postAction: () => readyToMoveOn = true);
        while (!readyToMoveOn)
        {
            yield return(null);
        }
    }
Esempio n. 8
0
    public void Poke()
    {
        int pokes = DataDump.Get <int>("LocalPetPokes") + 1;

        DataDump.Set("LocalPetPokes", pokes);
        var stage = (GrowthStage)DataDump.Get <int>("LocalPetGrowthStage");

        switch (stage)
        {
        case GrowthStage.Egg:
            Juicer.Instance.PlayPickSFX();
            if (pokes > 5)
            {
                DataDump.Set("LocalPetGrowthStage", 1);
            }
            break;

        case GrowthStage.Baby:
        case GrowthStage.Juvi:
            if (FoodMenu.activeSelf)
            {
                CloseFoodMenu();
                Juicer.Instance.PlayNaturalClip(CloseMenuClip);
            }
            else
            {
                SetFoodMenu();
                OpenFoodMenu();
                Juicer.Instance.PlayPickSFX();
            }
            break;

        case GrowthStage.Pheonix:
            Juicer.Instance.PlayPickSFX();
            StartCoroutine(Rebirth());
            break;
        }
    }