Пример #1
0
 // 生成処理
 public void Create(UNIQUEID uniqueId)
 {
     this.uniqueId = uniqueId;
     this.go_      = this.gameObject;
     this.trans_   = this.transform;
     this.go_.SetActive(false);
     this.OnCreate(); // 派生クラス処理
 }
Пример #2
0
 // オブジェクト取得
 // unique : ユニークID
 // obj : 対象オブジェクト
 // return : ID が一致したか(異なる場合は既に一度回収されている)
 public bool GetObject(UNIQUEID unique, out T obj)
 {
     // 関係のないユニークID
     if (this.category != unique.category)
     {
         obj = null;
         return(false);
     }
     obj = this.objList[unique.type][unique.index];
     if (!obj.isAlive)
     {
         return(false);
     }
     // フラッシュID が更新されていれば別人
     return(obj.uniqueId == unique);
 }
Пример #3
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);
        }