Mercurial > hg > Database > jungle-sharp
view src/main/csharp/jp.ac.u-ryukyu.ie.cr/ObjectMapper/SceneNode.cs @ 19:0865819106cf
add mapping code.
author | Kazuma |
---|---|
date | Mon, 05 Dec 2016 05:28:53 +0900 |
parents | |
children |
line wrap: on
line source
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SceneNode : MonoBehaviour { public GameObject obj; public SceneNode m_parent; public System.Collections.Generic.List<SceneNode> m_childs; public SceneNode(GameObject obj, SceneNode parent=null){ this.obj = obj; 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(); } }