本文整理汇总了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");
}
示例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");
}
}
示例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");
}
}
示例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");
}
}