コード例 #1
0
 public void Create(GameObject _gameObject, UNIQUEID _uniqueId, ScriptableObject _scriptable = null)
 {
     this.go_      = _gameObject;
     this.trans_   = go_.transform;
     this.uniqueId = _uniqueId;
     this.go_.SetActive(false);
     OnCreate(_gameObject, _scriptable, _uniqueId);
 }
コード例 #2
0
ファイル: UNIQUEID.cs プロジェクト: ProjectKBC/KettyEnemy
 public bool Equals(UNIQUEID p)
 {
     if ((object)p == null)
     {
         return(false);
     }
     return(this.uniqueId == p.uniqueId);
 }
コード例 #3
0
        public GameObject Create(string _name, UNIQUEID _uniqueId, ScriptableObject _scriptable = null)
        {
            this.go_      = new GameObject(_name);
            this.trans_   = go_.transform;
            this.uniqueId = _uniqueId;
            this.go_.SetActive(false);
            OnCreate(_name, _scriptable, _uniqueId);

            return(go_);
        }
コード例 #4
0
ファイル: UNIQUEID.cs プロジェクト: ProjectKBC/KettyEnemy
        public override bool Equals(System.Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            UNIQUEID p = (UNIQUEID)obj;

            return(this.uniqueId == p.uniqueId);
        }
コード例 #5
0
        // unique ユニークID
        // obj    対象オブジェクト
        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.Alive)
            {
                return(false);
            }

            // フラッシュID が更新されていれば別人
            return(obj.uniqueId == unique);
        }
コード例 #6
0
        // type オブジェクトの種類</param>
        private T GenerateObject(int type)
        {
            int index = this.objParams[type].genCount;
            ScriptableObject scriptable = this.objParams[type].scriptable;
            Transform        root       = this.objParams[type].root;
            GameObject       go         = new GameObject();

            go.transform.parent = root;

#if UNITY_EDITOR
            go.name = string.Format(this.objParams[type].scriptable.name + "{0:D2}",
                                    this.objParams[type].genCount);
#endif
            T obj = new T();

            // ユニークID を割り振り
            obj.Create(go, scriptable, UNIQUEID.Create(UNIQUEID.CATEGORYBIT(this.category) | UNIQUEID.TYPEBIT(type) | UNIQUEID.INDEXBIT(index)));

            this.objList[type][index] = obj;
            ++this.objParams[type].genCount;
            return(obj);
        }
コード例 #7
0
 protected abstract void OnCreate(string _name, ScriptableObject _scriptable, UNIQUEID _uniqueId);
コード例 #8
0
 protected abstract void OnCreate(GameObject _go, ScriptableObject _scriptable, UNIQUEID _uniqueId);
コード例 #9
0
 protected override void OnCreate(string _name, ScriptableObject _scriptable, UNIQUEID _uniqueId)
 {
     this.mScriptable = _scriptable as EnemyScriptableObject;
 }
コード例 #10
0
 protected override void OnCreate(GameObject _go, ScriptableObject _scriptable, UNIQUEID _uniqueId)
 {
     this.mScriptable = _scriptable as EnemyScriptableObject;
     this.sr_         = go_.AddComponent <SpriteRenderer>();
     this.sr_.sprite  = mScriptable.sprite;
 }