コード例 #1
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    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
        }
    }
コード例 #2
0
    public static void AdvanceDay()
    {
        string nextDay = _days.Dequeue();

        DataDump.Set("Day", nextDay);
        _days.Enqueue(nextDay);
    }
コード例 #3
0
ファイル: IntroState.cs プロジェクト: zr3/dontdeadit
    public IEnumerator OnUpdate()
    {
        yield return(new WaitForSeconds(3));

        DataDump.Set("LocalPetGrowthStage", 0);
        bool isFinished = false;

        ScreenFader.FadeInThen(() =>
        {
            //Juicer.ShakeCamera(0.5f);
            //MessageController.AddMessage("yo.");
            //MessageController.AddMessage("this is game peanutbutters.");
            //MessageController.AddMessage("it goes great with game jams.");
            //MessageController.AddMessage("you may have noticed the camera and music change. very easy to do with cinemachine and the juicer.", postAction: () =>
            //{
            //    GameConductor.CameraStateTrigger("NextState");
            //});
            //MessageController.AddMessage("these bois are moving with the simplemover script. it's an easy way to get some nice motion with little effort. useful for pickups, simple enemies, etc.", postAction: () =>
            //{
            //    GameConductor.CameraStateTrigger("NextState");
            //});
            //MessageController.AddMessage("this is a fun script called textjacker. it jacks up text.", postAction: () =>
            //{
            //    GameConductor.CameraStateTrigger("NextState");
            //});
            //MessageController.AddMessage("after this message finishes, the game will transition to the next game state. a basic player object will be created.");
            GameConductor.CameraStateTrigger("NextState");
            isFinished = true;
        });
        do
        {
            yield return(new WaitForSeconds(1));
        } while (!isFinished);
    }
コード例 #4
0
ファイル: MainGameState.cs プロジェクト: zr3/the-deja-brew
    private void SetTime()
    {
        string minutePrefix = niceMinute < 10 ? "0" : "";

        DataDump.Set("Time", $"{niceHour}:{minutePrefix}{niceMinute}");
        GameConductor.PerformScheduleCallbacks(niceHour, niceMinute);
    }
コード例 #5
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    private IEnumerator Sprout()
    {
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(2));

        DataDump.Set("LocalPetGrowthStage", 5);
        Juicer.ShakeCamera(3);
    }
コード例 #6
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    private IEnumerator Rebirth()
    {
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(2));

        DataDump.Set("LocalPetGrowthStage", 0);
        DataDump.Set("LocalPetPokes", 0);
        Juicer.ShakeCamera(3);
    }
コード例 #7
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    private IEnumerator Grow()
    {
        Juicer.ShakeCamera(0.5f);
        MessageController.AddMessage("it's growing!!");
        ImpulseMover.GoHomeHack();
        yield return(new WaitForSeconds(3));

        DataDump.Set("LocalPetGrowthStage", 3);
        Juicer.ShakeCamera(3);
    }
コード例 #8
0
ファイル: IntroState.cs プロジェクト: zr3/dontdeadit
 public void OnEnter()
 {
     GameConductor.CameraStateTrigger("Initialize");
     MusicBox.ChangeMusic(Song.Game.ToInt());
     DataDump.Set("Berries", 0);
     DataDump.Set("BerriesDiscovered", false);
     DataDump.Set("Cookies", 0);
     DataDump.Set("CookiesDiscovered", false);
     DataDump.Set("Fish", 0);
     DataDump.Set("FishDiscovered", false);
     GameConductor.SetShowHud(true);
 }
コード例 #9
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    private IEnumerator Die()
    {
        CloseFoodMenu();
        Juicer.ShakeCamera(1);
        MessageController.AddMessage("oh no...");
        ImpulseMover.GoHomeHack();
        yield return(new WaitForSeconds(3));

        int nextGrowthTime = CurrentTime + (MinutesSpentDead * 60);

        DataDump.Set("LocalPetNextGrowthTime", nextGrowthTime);
        DataDump.Set("LocalPetGrowthStage", (int)GrowthStage.Dead);
        Juicer.ShakeCamera(3);
    }
コード例 #10
0
    public void OnEnter()
    {
        player = GameObject.Instantiate(PlayerPrototype);
        player.transform.position = PlayerSpawnLocation;
        Juicer.CreateFx(0, PlayerSpawnLocation);
        Juicer.ShakeCamera(0.5f);
        MusicBox.ChangeMusic((int)Song.Boss);
        DataDump.Set("HP", maxHP);
        DataDump.Set("ScaledHP", 1.0f);
        var cam = GameObject.Find("CinemachineStateCamera/GameCam").GetComponent <CinemachineVirtualCamera>();

        cam.Follow = player.transform;
        cam.LookAt = player.transform;
        GameConductor.SetShowHud(true);
    }
コード例 #11
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    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());
        }
    }
コード例 #12
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    private IEnumerator Hatch()
    {
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(2));

        DataDump.Set("LocalPetGrowthStage", 2);
        DataDump.Set("LocalPetFullness", InitialFullness);
        DataDump.Set("LocalPetBerriesEaten", 0);
        DataDump.Set("LocalPetCookiesEaten", 0);
        DataDump.Set("LocalPetFishEaten", 0);
        DataDump.Set("LocalPetHappiness", 0);
        DataDump.Set("LocalPetAnnoyance", 0);
        int nextGrowthTime = CurrentTime + (MinutesSpentAsChild * 60);

        DataDump.Set("LocalPetNextGrowthTime", nextGrowthTime);
        Juicer.ShakeCamera(3);
    }
コード例 #13
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();
    }
コード例 #14
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);
        }
    }
コード例 #15
0
    void OnGameStart()
    {
        IEnumerator stateMachine(IState state)
        {
            do
            {
                Debug.Log($"Entering state {state.GetType()}");
                DataDump.Set("StateTitle", state.GetType().ToString());
                state.OnEnter();
                yield return(state.OnUpdate());

                Debug.Log($"Exiting state {state.GetType()}");
                state.OnExit();
                state = state.NextState;
            } while (state != null);
        }

        var initialState = new IntroState(DayCard);

        StartCoroutine(stateMachine(initialState));
    }
コード例 #16
0
ファイル: PetController.cs プロジェクト: zr3/dontdeadit
    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;
        }
    }