当前位置: 首页>>代码示例>>C#>>正文


C# Terrain.HasController方法代码示例

本文整理汇总了C#中Terrain.HasController方法的典型用法代码示例。如果您正苦于以下问题:C# Terrain.HasController方法的具体用法?C# Terrain.HasController怎么用?C# Terrain.HasController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Terrain的用法示例。


在下文中一共展示了Terrain.HasController方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnChunkRemove

        public void OnChunkRemove(Terrain.TerrainChunkNode chunk, EventArgs e)
        {
            if (chunk.HasController(typeof(GrassPopulator)))
            {
                GrassPopulator grass = (GrassPopulator)chunk.GetController(typeof(GrassPopulator));
                grass.Destroy();
                grass = null;
            }
            if (chunk.HasController(typeof(RockPopulator)))
            {
                RockPopulator rock = (RockPopulator)chunk.GetController(typeof(RockPopulator));
                rock.Destroy();
                rock = null;
            }

            if (chunk.HasController(typeof(TreePopulator)))
            {
                TreePopulator tree = (TreePopulator)chunk.GetController(typeof(TreePopulator));
                tree.Destroy();
                tree = null;
            }
        }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:22,代码来源:TestGame.cs

示例2: OnChunkAdd

        public void OnChunkAdd(Terrain.TerrainChunkNode chunk, EventArgs e)
        {
            if (!chunk.HasController(typeof(GrassPopulator)))
            {
                GrassPopulator grass;
                chunk.AddController(grass = new GrassPopulator(PhysicsWorld, cam));
                grass.GenPatches(chunk, 5, 12);
            }
            if (!chunk.HasController(typeof(RockPopulator)))
            {
                RockPopulator rock;
                chunk.AddController(rock = new RockPopulator(PhysicsWorld, cam));
                rock.GenPatches(chunk, 3, 3);
            }
            if (!chunk.HasController(typeof(TreePopulator)))
            {
                TreePopulator tree;
                chunk.AddController(tree = new TreePopulator(PhysicsWorld, cam));
                tree.GenPatches(chunk, 2, 2);
            }

            /*
            for (int i = 0; i < chunk.hm.heights.Length; i++)
            {
                chunk.hm.heights[i] = 0f;
            }
            chunk.hm.RebuildTerrainMesh();*/
        }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:28,代码来源:TestGame.cs


注:本文中的Terrain.HasController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。