Esempio n. 1
0
        // オブジェクトの生成
        // type : オブジェクトの種類
        private T GenerateObject(int type)
        {
            int        index  = this.objParams[type].genCount;
            GameObject prefab = this.objParams[type].prefab;
            Transform  root   = this.objParams[type].root;
            GameObject go     = Object.Instantiate(prefab, root) as GameObject;

#if UNITY_EDITOR
            go.name = string.Format(this.objParams[type].prefab.name + "{0:D2}",
                                    this.objParams[type].genCount);
#endif
            T obj = go.GetComponent <T>();
            // ユニークID を割り振り
            obj.Create(UNIQUEID.Create(
                           UNIQUEID.CATEGORYBIT(this.category) |
                           UNIQUEID.TYPEBIT(type) |
                           UNIQUEID.INDEXBIT(index)));
            this.objList[type][index] = obj;
            ++this.objParams[type].genCount;
            return(obj);
        }