Esempio n. 1
0
        // child-parent
        public void BuildHierarchy(INodeTable <string> table)
        {
            if (ParentObject != null)
            {
                Parent = table.Get <GameObjectNode>(ParentObject.GetInstanceID().ToString());
            }

            var childlist = new List <GameObjectNode>();
            var tr        = CurrentObject.transform;

            for (int i = 0; i < tr.childCount; i++)
            {
                var childtr = tr.GetChild(i);
                var child   = table.Get <GameObjectNode>(childtr.gameObject.GetInstanceID().ToString());
                childlist.Add(child);
            }
            Children = childlist.ToArray();
        }
        public override void Initialize <T1>(T1 comp, INodeTable <int> containerTable)
        {
            base.Initialize(comp, containerTable);

            // find mesh & material
            if (Value is MeshRenderer || Value is SkinnedMeshRenderer)
            {
                var mesh = ComponentHelper.GetMesh(Value.gameObject);
                Mesh = containerTable.Get <MeshContainer>(mesh.GetInstanceID());

                // TODO material이 여러개인 경우는?
                var mtl = Value.sharedMaterial;
                Material = containerTable.Get <MaterialContainer>(mtl.GetInstanceID());
            }
            else
            {
                throw new NotImplementedException("unknown renderer " + comp.GetType().ToString());
            }
        }