本文整理汇总了C#中HkdBreakableShape.GetChildrenCount方法的典型用法代码示例。如果您正苦于以下问题:C# HkdBreakableShape.GetChildrenCount方法的具体用法?C# HkdBreakableShape.GetChildrenCount怎么用?C# HkdBreakableShape.GetChildrenCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HkdBreakableShape
的用法示例。
在下文中一共展示了HkdBreakableShape.GetChildrenCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsBreakableShapeCompound
private static bool IsBreakableShapeCompound(HkdBreakableShape shape)
{
return (string.IsNullOrEmpty(shape.Name) || shape.IsCompound() || shape.GetChildrenCount() > 0);
}
示例2: CheckVolumeMassRec
private bool CheckVolumeMassRec(HkdBreakableShape bShape, float minVolume, float minMass)
{
if (bShape.Name.Contains("Fake"))
return true;
if (bShape.Volume <= minVolume)
return false;
HkMassProperties mp = new HkMassProperties();
bShape.BuildMassProperties(ref mp);
if (mp.Mass <= minMass)
return false;
if (mp.InertiaTensor.M11 == 0 || mp.InertiaTensor.M22 == 0 || mp.InertiaTensor.M33 == 0)
return false;
for (int i = 0; i < bShape.GetChildrenCount(); i++)
{
if (!CheckVolumeMassRec(bShape.GetChildShape(i), minVolume, minMass))
return false;
}
return true;
}
示例3: ConvertAllShapesToFractureComponentShapeBuilder
private static void ConvertAllShapesToFractureComponentShapeBuilder(HkdBreakableShape shape, ref Matrix shapeRotation, MyBlockOrientation blockOrientation, HashSet<string> names, MyObjectBuilder_FractureComponentCubeBlock fractureComponentBuilder)
{
var name = shape.Name;
if (names.Contains(name))
{
MyBlockOrientation shapeOrientation = new MyBlockOrientation(ref shapeRotation);
if (shapeOrientation == blockOrientation)
{
MyObjectBuilder_FractureComponentCubeBlock.FracturedShape builderShape = new MyObjectBuilder_FractureComponentBase.FracturedShape();
builderShape.Name = name;
builderShape.Fixed = MyDestructionHelper.IsFixed(shape);
fractureComponentBuilder.Shapes.Add(builderShape);
}
}
if (shape.GetChildrenCount() > 0)
{
List<HkdShapeInstanceInfo> children = new List<HkdShapeInstanceInfo>();
shape.GetChildren(children);
foreach (var child in children)
{
var childShapeRotation = child.GetTransform();
ConvertAllShapesToFractureComponentShapeBuilder(child.Shape, ref childShapeRotation, blockOrientation, names, fractureComponentBuilder);
}
}
}
示例4: GetAllBlockBreakableShapeNames
private static void GetAllBlockBreakableShapeNames(HkdBreakableShape shape, HashSet<string> outNames)
{
var name = shape.Name;
if (!string.IsNullOrEmpty(name))
outNames.Add(name);
if (shape.GetChildrenCount() > 0)
{
List<HkdShapeInstanceInfo> children = new List<HkdShapeInstanceInfo>();
shape.GetChildren(children);
foreach (var child in children)
GetAllBlockBreakableShapeNames(child.Shape, outNames);
}
}
示例5: GetCurrentFracturedShapeList
private static bool GetCurrentFracturedShapeList(HkdBreakableShape breakableShape, List<MyObjectBuilder_FractureComponentBase.FracturedShape> shapeList, string[] excludeShapeNames = null)
{
Debug.Assert(breakableShape.IsValid());
if (!breakableShape.IsValid())
return false;
var shapeName = breakableShape.Name;
bool shapeNameEmpty = string.IsNullOrEmpty(shapeName);
if (excludeShapeNames != null && !shapeNameEmpty)
{
foreach (var shapeNameToRemove in excludeShapeNames)
{
if (shapeName == shapeNameToRemove)
return false;
}
}
if (breakableShape.GetChildrenCount() > 0)
{
List<HkdShapeInstanceInfo> shapeInst = new List<HkdShapeInstanceInfo>();
breakableShape.GetChildren(shapeInst);
bool allChildrenAdded = true;
foreach (var inst in shapeInst)
{
allChildrenAdded &= GetCurrentFracturedShapeList(inst.Shape, shapeList, excludeShapeNames: excludeShapeNames);
}
if (!shapeNameEmpty && allChildrenAdded)
{
foreach (var inst in shapeInst)
{
if (inst.Shape.IsValid())
shapeList.RemoveAll(s => s.Name == inst.ShapeName);
}
shapeList.Add(new MyObjectBuilder_FractureComponentBase.FracturedShape() { Name = shapeName, Fixed = breakableShape.IsFixed() });
}
return allChildrenAdded;
}
else
{
if (!shapeNameEmpty)
{
shapeList.Add(new MyObjectBuilder_FractureComponentBase.FracturedShape() { Name = shapeName, Fixed = breakableShape.IsFixed() });
return true;
}
}
return false;
}
示例6: ConvertAllShapesToFractureComponentShapeBuilder
private static void ConvertAllShapesToFractureComponentShapeBuilder(HkdBreakableShape shape, ref Matrix shapeRotation, MyBlockOrientation blockOrientation,
HashSet<Tuple<string, float>> namesAndBuildProgress, MyObjectBuilder_FractureComponentCubeBlock fractureComponentBuilder, out float buildProgress)
{
buildProgress = 1f;
var name = shape.Name;
Tuple<string, float> foundTuple = null;
foreach (var tuple in namesAndBuildProgress)
{
if (tuple.Item1 == name)
{
foundTuple = tuple;
break;
}
}
if (foundTuple != null)
{
MyBlockOrientation shapeOrientation = new MyBlockOrientation(ref shapeRotation);
if (shapeOrientation == blockOrientation)
{
MyObjectBuilder_FractureComponentCubeBlock.FracturedShape builderShape = new MyObjectBuilder_FractureComponentBase.FracturedShape();
builderShape.Name = name;
builderShape.Fixed = MyDestructionHelper.IsFixed(shape);
fractureComponentBuilder.Shapes.Add(builderShape);
buildProgress = foundTuple.Item2;
}
}
if (shape.GetChildrenCount() > 0)
{
List<HkdShapeInstanceInfo> children = new List<HkdShapeInstanceInfo>();
shape.GetChildren(children);
foreach (var child in children)
{
var childShapeRotation = child.GetTransform();
float localBuildProgress;
ConvertAllShapesToFractureComponentShapeBuilder(child.Shape, ref childShapeRotation, blockOrientation, namesAndBuildProgress,
fractureComponentBuilder, out localBuildProgress);
if (foundTuple == null)
buildProgress = localBuildProgress;
}
}
}
示例7: GetAllBlockBreakableShapeNames
public static void GetAllBlockBreakableShapeNames(HkdBreakableShape shape, HashSet<Tuple<string, float>> outNamesAndBuildProgress, float buildProgress)
{
var name = shape.Name;
if (!string.IsNullOrEmpty(name))
outNamesAndBuildProgress.Add(new Tuple<string, float>(name, buildProgress));
if (shape.GetChildrenCount() > 0)
{
List<HkdShapeInstanceInfo> children = new List<HkdShapeInstanceInfo>();
shape.GetChildren(children);
foreach (var child in children)
GetAllBlockBreakableShapeNames(child.Shape, outNamesAndBuildProgress, buildProgress);
}
}