Mercurial > hg > Database > jungle-sharp
view Main/ObjectMapper/SceneNode.cs @ 38:e954d456665c
library is made by rake
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Feb 2017 16:58:10 +0900 |
parents | 1f99e150f336 |
children |
line wrap: on
line source
using System.Collections; using System.Collections.Generic; // using UnityEngine; using System; namespace JungleDB { [Serializable] public class SceneNode { public GameObject obj; public string Name; public SceneNode m_parent; [SerializeField] public System.Collections.Generic.List<SceneNode> m_childs; public SceneNode(GameObject obj, SceneNode parent=null){ this.obj = obj; this.Name = obj.name; m_parent = parent; m_childs = new System.Collections.Generic.List<SceneNode>(); } public void OnAdded () {} public void OnRemoved () {} public bool AddChild (SceneNode toAdd){ toAdd.m_parent = this; m_childs.Add(toAdd); toAdd.OnAdded(); return true; } public bool RemoveChild (SceneNode toRemove) { toRemove.OnRemoved(); return m_childs.Remove(toRemove); } public void RemoveAllChildren () { int childcount = m_childs.Count; for(int i = 0; i < childcount ;++i){ m_childs[i].RemoveAllChildren(); } for(int i = 0; i < childcount ;++i){ m_childs[i].OnRemoved(); } m_childs.Clear(); } } }