本文整理汇总了C#中IMyCubeGrid.RazeBlocks方法的典型用法代码示例。如果您正苦于以下问题:C# IMyCubeGrid.RazeBlocks方法的具体用法?C# IMyCubeGrid.RazeBlocks怎么用?C# IMyCubeGrid.RazeBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMyCubeGrid
的用法示例。
在下文中一共展示了IMyCubeGrid.RazeBlocks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteReverse
private void DeleteReverse(string id, int remove, IMyCubeGrid grid)
{
int count = 0;
Sandbox.ModAPI.Ingame.IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid);
List<IMyTerminalBlock> blocksToRemove = new List<IMyTerminalBlock>();
for (int r = gridTerminal.Blocks.Count - 1; r >= 0; r--)
{
IMyTerminalBlock block = (IMyTerminalBlock)gridTerminal.Blocks[r];
if (block.BlockDefinition.TypeId.ToString().Contains(id))
{
blocksToRemove.Add(block);
count++;
}
if (count == remove)
break;
}
/*
List<MyObjectBuilder_CubeBlock> blocksToRemove = new List<MyObjectBuilder_CubeBlock>();
for (int r = gridBuilder.CubeBlocks.Count - 1; r >= 0; r--)
{
MyObjectBuilder_CubeBlock block = gridBuilder.CubeBlocks[r];
if (block.GetId().ToString().Contains(id))
{
blocksToRemove.Add(block);
count++;
}
if (count == remove)
break;
}
*/
if (blocksToRemove.Count < 1)
return;
List<VRageMath.Vector3I> razeList = new List<VRageMath.Vector3I>();
foreach (IMyTerminalBlock block in blocksToRemove)
{
razeList.Add(block.Min);
}
Wrapper.GameAction(() =>
{
grid.RazeBlocks(razeList);
});
}