コード例 #1
0
    void PerformAction(string action)
    {
        //play animation after each action
        action = action.ToLower();
        switch (action)
        {
        case "sleep":
            //perhaps it returns you to fully rested state
            statsBars.IncreaseSleep(1.0f);
            statsBars.ReduceSpirit(2.0f);
            clock.timeStart += 60f;
            PerformAnimation(action);
            break;

        case "nap":
            statsBars.IncreaseSleep(0.5f);
            statsBars.IncreaseSpirit(2.0f);
            clock.timeStart += 30f;
            PerformAnimation(action);
            break;

        case "work":
            statsBars.ReduceSleep(2.0f);
            statsBars.ReduceSanity(1.5f);
            clock.timeStart += 60f;
            PerformAnimation(action);
            break;

        case "research":
            statsBars.ReduceSanity(0.5f);
            statsBars.ReduceSleep(0.5f);
            clock.timeStart += 30f;
            PerformAnimation(action);
            SceneManager.LoadScene("Synonymous");
            break;

        case "study":
            statsBars.ReduceSanity(0.5f);
            statsBars.ReduceSleep(0.5f);
            clock.timeStart += 30f;
            PerformAnimation(action);
            SceneManager.LoadScene("Conext");
            break;

        case "read":
            statsBars.ReduceSanity(0.5f);
            statsBars.ReduceSleep(0.5f);
            clock.timeStart += 30f;
            PerformAnimation(action);
            break;

        case "play games":
            statsBars.IncreaseSanity(1.0f);
            statsBars.ReduceSleep(0.5f);
            clock.timeStart += 60f;
            PerformAnimation(action);
            break;

        case "submit":
            if (statsBars.CurrentProgress == 20f)
            {
                SceneManager.LoadScene("Submit");
            }
            else
            {
                Debug.Log("YOU CANNOT SUBMIT!");
            }
            break;

        default:
            break;
        }
    }