本文整理汇总了C#中Sandbox.Game.Entities.Cube.MySlimBlock.GetFractureComponent方法的典型用法代码示例。如果您正苦于以下问题:C# MySlimBlock.GetFractureComponent方法的具体用法?C# MySlimBlock.GetFractureComponent怎么用?C# MySlimBlock.GetFractureComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Game.Entities.Cube.MySlimBlock
的用法示例。
在下文中一共展示了MySlimBlock.GetFractureComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DebugDrawMountPoints
private void DebugDrawMountPoints(MySlimBlock block)
{
if (block.FatBlock is MyCompoundCubeBlock)
{
MyCompoundCubeBlock compoundBlock = block.FatBlock as MyCompoundCubeBlock;
foreach (MySlimBlock componentBlock in compoundBlock.GetBlocks())
{
DebugDrawMountPoints(componentBlock);
}
}
else
{
Matrix blockMatrix;
block.GetLocalMatrix(out blockMatrix);
MatrixD blockWorldMatrix = blockMatrix * m_cubeGrid.WorldMatrix;
if (MyFakes.ENABLE_FRACTURE_COMPONENT && block.FatBlock != null && block.FatBlock.Components.Has<MyFractureComponentBase>())
{
var fractureComponent = block.GetFractureComponent();
if (fractureComponent != null)
MyCubeBuilder.DrawMountPoints(m_cubeGrid.GridSize, block.BlockDefinition, blockWorldMatrix, fractureComponent.MountPoints.GetInternalArray());
}
else
{
MyCubeBuilder.DrawMountPoints(m_cubeGrid.GridSize, block.BlockDefinition, ref blockWorldMatrix);
}
}
}
示例2: RemoveFractureComponentChildShapes
private static void RemoveFractureComponentChildShapes(MySlimBlock block, string[] shapeNames)
{
var component = block.GetFractureComponent();
if (component != null)
{
component.RemoveChildShapes(shapeNames);
}
else
{
Debug.Fail("Cannot remove child shapes from fracture component, fracture component not found in block");
MyLog.Default.WriteLine("Cannot remove child shapes from fracture component, fracture component not found in block, BlockDefinition: "
+ block.BlockDefinition.Id.ToString() + ", Shapes: " + string.Join(", ", shapeNames));
}
}
示例3: RemoveShapesFromFracturedBlocks
/// <summary>
/// Removes breakable shapes form fracture component.
/// </summary>
/// <param name="bBody">body with shapes</param>
/// <param name="block">block</param>
/// <param name="blocksToDelete">collection of blocks to remove from grid</param>
/// <param name="blocksUpdateDamage">collection of blocks for updating their damage according to remaining shapes count</param>
/// <returns>true if block was processes otherwise false (block in compound does not exist)</returns>
private bool RemoveShapesFromFracturedBlocks(HkdBreakableBody bBody, MySlimBlock block, ushort? compoundId, HashSet<MySlimBlock> blocksToDelete, HashSet<MySlimBlock> blocksUpdateDamage)
{
Debug.Assert(MyFakes.ENABLE_FRACTURE_COMPONENT);
// Block can be removed when the removed shape is the last one!
MyFractureComponentCubeBlock fractureComponent = block.GetFractureComponent();
if (fractureComponent != null)
{
bool removeBlock = false;
var bShape = bBody.BreakableShape;
if (IsBreakableShapeCompound(bShape))
{
m_tmpShapeNames.Clear();
m_tmpChildren_RemoveShapes.Clear();
bShape.GetChildren(m_tmpChildren_RemoveShapes);
var shapesCount = m_tmpChildren_RemoveShapes.Count;
for (int i = 0; i < shapesCount; ++i)
{
var child = m_tmpChildren_RemoveShapes[i];
if (string.IsNullOrEmpty(child.ShapeName))
child.Shape.GetChildren(m_tmpChildren_RemoveShapes);
}
m_tmpChildren_RemoveShapes.ForEach(delegate(HkdShapeInstanceInfo c)
{
var shapeName = c.ShapeName;
if (!string.IsNullOrEmpty(shapeName))
m_tmpShapeNames.Add(shapeName);
});
if (m_tmpShapeNames.Count != 0)
{
removeBlock = fractureComponent.RemoveChildShapes(m_tmpShapeNames);
MySyncDestructions.RemoveShapesFromFractureComponent(block.CubeGrid.EntityId, block.Position, compoundId ?? 0xFFFF, m_tmpShapeNames);
}
m_tmpChildren_RemoveShapes.Clear();
m_tmpShapeNames.Clear();
}
else
{
var name = bBody.BreakableShape.Name;
removeBlock = fractureComponent.RemoveChildShapes(new string[] { name });
MySyncDestructions.RemoveShapeFromFractureComponent(block.CubeGrid.EntityId, block.Position, compoundId ?? 0xFFFF, name);
}
if (removeBlock)
blocksToDelete.Add(block);
else
blocksUpdateDamage.Add(block);
}
else
{
blocksToDelete.Add(block);
}
return true;
}