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


C# MyCubeGrid.DetectMerge方法代码示例

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


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

示例1: AfterStaticGridSpawn

        public static void AfterStaticGridSpawn(MyCubeGrid grid)
        {
            Debug.Assert(grid.IsStatic);

            MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
            if (block != null)
            {
                MyCubeGrid mainGrid = grid.DetectMerge(block);
                if (mainGrid == null)
                    mainGrid = grid;
                mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(block));

                if (MyFakes.ENABLE_SMALL_BLOCK_TO_LARGE_STATIC_CONNECTIONS)
                {
                    MyCubeGridSmallToLargeConnection.Static.CheckBlockSmallToLargeConnect(block);
                }
            }
            else
                Debug.Fail("Block not created");
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:20,代码来源:MyCubeBuilder.cs

示例2: AfterGridBuild

        protected static void AfterGridBuild(MyEntity builder, MyCubeGrid grid, bool instantBuild)
        {
            if (grid != null)
            {
                MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
                if (block != null)
                {
                    if (grid.IsStatic)
                    {
                        MyCompoundCubeBlock compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                        MySlimBlock blockInCompound = compoundBlock != null && compoundBlock.GetBlocksCount() > 0 ? compoundBlock.GetBlocks()[0] : null;

                        MyCubeGrid mainGrid = grid.DetectMerge(block);
                        if (mainGrid == null)
                            mainGrid = grid;

                        MySlimBlock mainBlock = block;
                        if (blockInCompound != null)
                        {
                            Debug.Assert(blockInCompound.CubeGrid == mainGrid);
                            mainBlock = mainGrid.GetCubeBlock(blockInCompound.Position);
                        }

                        mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(mainBlock));

                        if (MyCubeGridSmallToLargeConnection.Static != null)
                        {
                            if (Sync.IsServer && !MyCubeGridSmallToLargeConnection.Static.AddBlockSmallToLargeConnection(block) && grid.GridSizeEnum == MyCubeSize.Small)
                                block.CubeGrid.TestDynamic = true;
                        }
                    }

                    if (Sync.IsServer)
                    {
                        MyCubeBuilder.BuildComponent.AfterSuccessfulBuild(builder, instantBuild);
                    }

                    if (block.FatBlock != null)
                        block.FatBlock.OnBuildSuccess(builder.EntityId);
                }
                else
                    Debug.Fail("Block not created");

                
            }
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:46,代码来源:MyCubeBuilder.cs

示例3: AfterGridBuild

        public static void AfterGridBuild(MyEntity builder, MyCubeGrid grid)
        {
            if (grid != null)
            {
                MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
                if (block != null)
                {
                    if (grid.IsStatic)
                    {
                        MyCubeGrid mainGrid = grid.DetectMerge(block);
                        if (mainGrid == null)
                            mainGrid = grid;
                        mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(block));

                        if (MyFakes.ENABLE_SMALL_BLOCK_TO_LARGE_STATIC_CONNECTIONS)
                        {
                            MyCubeGridSmallToLargeConnection.Static.AddBlockSmallToLargeConnection(block);
                        }
                    }

                    if (Sync.IsServer)
                    {
                        MyCubeBuilder.BuildComponent.AfterGridCreated(grid, builder);
                    }
                }
                else
                    Debug.Fail("Block not created");
            }
        }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:29,代码来源:MyCubeBuilder.cs

示例4: AfterGridBuild

        public static void AfterGridBuild(MyEntity builder, MyCubeGrid grid)
        {
            if (grid != null)
            {
                MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
                if (block != null)
                {
                    if (grid.IsStatic)
                    {
                        MyCompoundCubeBlock compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                        MySlimBlock blockInCompound = compoundBlock != null && compoundBlock.GetBlocksCount() > 0 ? compoundBlock.GetBlocks()[0] : null;

                        MyCubeGrid mainGrid = grid.DetectMerge(block);
                        if (mainGrid == null)
                            mainGrid = grid;

                        MySlimBlock mainBlock = block;
                        if (blockInCompound != null)
                        {
                            Debug.Assert(blockInCompound.CubeGrid == mainGrid);
                            mainBlock = mainGrid.GetCubeBlock(blockInCompound.Position);
                        }

                        mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(mainBlock));

                        if (MyFakes.ENABLE_SMALL_BLOCK_TO_LARGE_STATIC_CONNECTIONS)
                        {
                            if (!MyCubeGridSmallToLargeConnection.Static.AddBlockSmallToLargeConnection(block) && grid.GridSizeEnum == MyCubeSize.Small)
                                block.CubeGrid.TestDynamic = true;
                        }
                    }

                    if (Sync.IsServer)
                    {
                        MyCubeBuilder.BuildComponent.AfterGridCreated(grid, builder);
                    }
                }
                else
                    Debug.Fail("Block not created");
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:41,代码来源:MyCubeBuilder.cs


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