internal void OnDelete() { if (_componentList != null) { parents = null; _componentList.Clear(); _componentList = null; } _isAlive = false; }
public SGameObject(string objname) { SDebug.Assert(SFrameWork.frameWork != null); transform = AddComponent <STransform>(); transform2D = AddComponent <STransform2D>(); _parents = null; _name = objname; SFrameWork.frameWork.AddToList(this); }
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); }
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); }
public bool RemoveChild(SGameObject child) { if (_children.Contains(child)) { child._parents = null; _children.Remove(child); return(true); } else { return(false); } }
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); }
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); }
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); }
private void Remove(SGameObject obj) { _wilDeleteSGOQueue.Enqueue(obj); _cmdQueue.Enqueue(Remove); }
internal void AddToList(SGameObject sGameObject) { _willAddSGOQueue.Enqueue(sGameObject); _cmdQueue.Enqueue(AddToList); //_gameObjectList.Add(sGameObject); }
internal void DestroyGameObject(SGameObject obj) { obj.OnDestroy(); _gameObjectList.Remove(obj); }