本文整理汇总了C#中Sandbox.Game.Entities.MyCubeGrid.RazeBlocks方法的典型用法代码示例。如果您正苦于以下问题:C# MyCubeGrid.RazeBlocks方法的具体用法?C# MyCubeGrid.RazeBlocks怎么用?C# MyCubeGrid.RazeBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Game.Entities.MyCubeGrid
的用法示例。
在下文中一共展示了MyCubeGrid.RazeBlocks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddGrid
public bool AddGrid(MyCubeGrid grid)
{
//TODO: create static list
List<Vector3I> lst = new List<Vector3I>();
foreach (var block in grid.GetBlocks())
{
if (block.FatBlock is MyCompoundCubeBlock)
{
bool added = false;
foreach (var subb in (block.FatBlock as MyCompoundCubeBlock).GetBlocks())
{
if (AddBlock(subb))
{
if (!added)
lst.Add(block.Position);
added = true;
}
}
}
else
{
if (AddBlock(block))
{
lst.Add(block.Position);
}
}
}
if (lst.Count > 0)
{
grid.RazeBlocks(lst);
return true;
}
return false;
}
示例2: AddGrid
public bool AddGrid(MyCubeGrid grid)
{
HashSet<Sandbox.Game.Entities.Cube.MySlimBlock> lst = new HashSet<Sandbox.Game.Entities.Cube.MySlimBlock>();
foreach (var block in grid.GetBlocks())
{
if (block.FatBlock is MyCompoundCubeBlock)
{
bool added = false;
foreach (var subb in (block.FatBlock as MyCompoundCubeBlock).GetBlocks())
{
if (AddBlock(subb))
{
added = true;
}
}
if (added)
{
lst.Add(block);
}
}
else
{
if (AddBlock(block))
{
lst.Add(block);
}
}
}
foreach (var b in lst)
{
Vector3I pos = b.Position;
Vector3UByte size = new Vector3UByte(1, 1, 1);
grid.RazeBlocks(ref pos, ref size);
// grid.RemoveBlock(b, true); not synced
}
return lst.Count > 0;
}