コード例 #1
0
    public static ScriptablePeopleAll MakePeopleData(int count)
    {
        ScriptablePeopleAll obj = ScriptableObject.CreateInstance <ScriptablePeopleAll>();

        for (int i = 0; i < count; ++i)
        {
            PeopleData p = new PeopleData();
            p.m_staticStatistic.name      = "name" + i;
            p.m_staticStatistic.id        = i;
            p.m_staticStatistic.MoveSpeed = 3;
            p.m_staticStatistic.Power     = 0.01f;

            p.CalStatistic();
            obj.m_data.Add(p);
        }

#if UnityEditor
        UnityEditor.AssetDatabase.CreateAsset(obj, "Assets/Resources/Data/d_people_all.asset");
        UnityEditor.AssetDatabase.SaveAssets();
        UnityEditor.AssetDatabase.Refresh();
#endif
        return(obj);
    }
コード例 #2
0
    void LoadPeopleStock()
    {
        ScriptablePeopleAll ass = ScriptablePeopleAll.MakePeopleData(TestCount);

        PeopleStock = ass.m_data;
    }