예제 #1
0
파일: Body.cs 프로젝트: zameran/SpaceW
        protected override void InitNode()
        {
            Storages = new List <TileStorage>(GetComponentsInChildren <TileStorage>(true));

            for (var storageIndex = 0; storageIndex < Storages.Count; storageIndex++)
            {
                var storage = Storages[storageIndex];

                storage.InitNode();
            }

            TerrainNodes = new List <TerrainNode>(GetComponentsInChildren <TerrainNode>(true));
            TerrainNodes.Sort(new TerrainNode.Sort());

            if (Atmosphere != null)
            {
                if (Atmosphere.ParentBody == null)
                {
                    Atmosphere.ParentBody = this;
                }

                Atmosphere.InitNode();
            }

            if (Ocean != null)
            {
                if (Ocean.ParentBody == null)
                {
                    Ocean.ParentBody = this;
                }

                Ocean.InitNode();
            }

            if (Ring != null)
            {
                if (Ring.ParentBody == null)
                {
                    Ring.ParentBody = this;
                }

                Ring.InitNode();
            }

            for (var terrainNodeIndex = 0; terrainNodeIndex < TerrainNodes.Count; terrainNodeIndex++)
            {
                var terrainNode = TerrainNodes[terrainNodeIndex];

                terrainNode.InitNode();

                for (var samplerNodeIndex = 0; samplerNodeIndex < terrainNode.Samplers.Count; samplerNodeIndex++)
                {
                    var samplerNode = terrainNode.Samplers[samplerNodeIndex];

                    samplerNode.InitNode();
                }
            }

            MPB = new MaterialPropertyBlock();

            Keywords = new List <string>();

            InitUniforms(MPB);
        }