コード例 #1
0
    void Awake()
    {
        //setup the player's default stats
        playerStatistics.SetStat("baseHP", (double)20);
        playerStatistics.SetStat("baseMP", (double)10);
        playerStatistics.SetStat("baseFull", (double)50);
        playerStatistics.SetStat("baseHunger", (double)1);

        //set the maximum stats
        playerStatistics.SetStat("maxHP", playerStatistics.GetStat("baseHP"));
        playerStatistics.SetStat("maxMP", playerStatistics.GetStat("baseMP"));
        playerStatistics.SetStat("maxFull", playerStatistics.GetStat("baseFull"));

        //set the current stats
        playerStatistics.SetStat("currentHP", playerStatistics.GetStat("maxHP"));
        playerStatistics.SetStat("currentMP", playerStatistics.GetStat("maxMP"));
        playerStatistics.SetStat("currentFull", playerStatistics.GetStat("maxFull"));
        playerStatistics.SetStat("currentHunger", playerStatistics.GetStat("baseHunger"));

        //run the code
        environment = new Toy.Environment();

        Toy.Runner.RunFile(environment, Application.streamingAssetsPath + "/" + loadablePackageName + "/main.toy");

        //tick once to allow loading
        TickEntities();
    }