コード例 #1
0
 internal void OnDelete()
 {
     if (_componentList != null)
     {
         parents = null;
         _componentList.Clear();
         _componentList = null;
     }
     _isAlive = false;
 }
コード例 #2
0
        public SGameObject(string objname)
        {
            SDebug.Assert(SFrameWork.frameWork != null);
            transform   = AddComponent <STransform>();
            transform2D = AddComponent <STransform2D>();
            _parents    = null;

            _name = objname;

            SFrameWork.frameWork.AddToList(this);
        }
コード例 #3
0
        public SGameObject(STransform2D transform2D)
        {
            SDebug.Assert(SFrameWork.frameWork != null);
            this.transform = AddComponent <STransform>();
            _componentList.Add(typeof(STransform2D), transform2D);
            this.transform2D = transform2D;
            _parents         = null;

            _name = "New_SGameObject_" + SFrameWork.frameWork.gameObjectNum;
            SFrameWork.frameWork.AddToList(this);
        }
コード例 #4
0
        public SGameObject()
        {
            SDebug.Assert(SFrameWork.frameWork != null);
            transform   = AddComponent <STransform>();
            transform2D = AddComponent <STransform2D>();
            _parents    = null;

            _name = "New_SGameObject_" + SFrameWork.frameWork.gameObjectNum;

            SFrameWork.frameWork.AddToList(this);
        }
コード例 #5
0
 public bool RemoveChild(SGameObject child)
 {
     if (_children.Contains(child))
     {
         child._parents = null;
         _children.Remove(child);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #6
0
        public bool AddChirld(SGameObject child)
        {
            if (child == null || child == this || _children.Contains(child))
            {
                return(false);
            }
            if (child._parents != null)
            {
                child._parents.RemoveChild(child);
            }
            child._parents = this;
            _children.Add(child);

            return(true);
        }
コード例 #7
0
        public void Destroy(SGameObject obj)
        {
            List <SGameObject> tem = obj.children;

            for (int i = tem.Count - 1; i >= 0; --i)
            {
                Destroy(tem[i]);
            }
            // foreach (var i in obj.children)
            // {
            //     Destroy(i);
            // }
            // obj.OnDestroy();
            Remove(obj);
        }
コード例 #8
0
        public SGameObject(SGameObject parents, string name)
        {
            SDebug.Assert(SFrameWork.frameWork != null);
            transform   = AddComponent <STransform>();
            transform2D = AddComponent <STransform2D>();
            if (parents != null && parents.isAlive)
            {
                this.parents = parents;
            }
            else
            {
                this.parents = null;
            }
            transform2D.localPosition = SVector2.zero;
            transform2D.localRotation = (Fix64)0;

            _name = name;
            SFrameWork.frameWork.AddToList(this);
        }
コード例 #9
0
 private void Remove(SGameObject obj)
 {
     _wilDeleteSGOQueue.Enqueue(obj);
     _cmdQueue.Enqueue(Remove);
 }
コード例 #10
0
 internal void AddToList(SGameObject sGameObject)
 {
     _willAddSGOQueue.Enqueue(sGameObject);
     _cmdQueue.Enqueue(AddToList);
     //_gameObjectList.Add(sGameObject);
 }
コード例 #11
0
 internal void DestroyGameObject(SGameObject obj)
 {
     obj.OnDestroy();
     _gameObjectList.Remove(obj);
 }