Exemple #1
0
    // Update is called once per frame
    async UniTaskVoid Update()
    {
        if (!canUpdate)
        {
            return;
        }
        canUpdate = false;

        switch (state)
        {
        case State.Title:
            itemManager.ResetEveryGame();
            await userInterface.TitleWaitInputAsync();

            await userInterface.FirstExplainAsync();

            state = State.MainGame;
            break;

        case State.MainGame:
            itemManager.ResetEveryPhase();
            playerStatus.Reset();

            userInterface.UpdateFloor(currentStage);
            if (stages[currentStage] == 0)
            {
                userInterface.CurrentPhase = Phase.Battle;
                await battlePhase.BegineAsync(currentStage);
            }
            else if (stages[currentStage] == 1)
            {
                userInterface.CurrentPhase = Phase.ItemStore;
                await itemStorePhase.BegineAsync(currentStage);
            }

            if (playerStatus.Hp > 0)    //やられてない時
            {
                ++currentStage;
                if (currentStage == maxStages)
                {
                    state = State.GoodEnding;
                }
            }
            else      //やられたとき
            {
                state = State.BadEnding;
            }
            break;

        case State.GoodEnding:
            await userInterface.EndingWaitInputAsync(true);

            EnterTitle();
            break;

        case State.BadEnding:
            await userInterface.EndingWaitInputAsync(false);

            EnterTitle();
            break;
        }

        canUpdate = true;
    }