本文整理汇总了C#中ShapeBase.HasChildren方法的典型用法代码示例。如果您正苦于以下问题:C# ShapeBase.HasChildren方法的具体用法?C# ShapeBase.HasChildren怎么用?C# ShapeBase.HasChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShapeBase
的用法示例。
在下文中一共展示了ShapeBase.HasChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSoundShapesRecursive
void AddSoundShapesRecursive(ShapeCollection shapeList, ShapeBase parent)
{
if (parent.ShapeVirtualCounter > 0 || !parent.Modifiable)
return;
ShapeBase soundShape = parent as ShapeObject3D;
if (soundShape != null && (soundShape.GetType().FullName == "SoundEditorPlugin.SoundShape" || soundShape.GetType().FullName == "SoundEditorPlugin.SoundCollisionShape"))
shapeList.Add(soundShape);
if (parent.HasChildren())
foreach (ShapeBase shape in parent.ChildCollection)
AddSoundShapesRecursive(shapeList, shape);
}
示例2: AddPhysXComponentsRecursive
void AddPhysXComponentsRecursive(ShapeComponentCollection list, ShapeCollection entityList, ShapeBase parent)
{
if (parent.ShapeVirtualCounter > 0 || !parent.Modifiable)
return;
if (parent.ComponentCount > 0)
{
foreach (ShapeComponent comp in parent.Components)
{
if (!comp.Missing)
continue;
if (comp.DisplayName == "vPhysXRigidBody" || comp.DisplayName == "vPhysXCharacterController")
{
// Catch invalid casts
try
{
UInt32 iValue = System.Convert.ToUInt32(comp.GetPropertyValue("m_iCollisionBitmask", false));
if (iValue != 0)
list.Add(comp);
}
catch(InvalidCastException)
{}
}
}
}
EntityShape entity = parent as EntityShape;
if (entity != null && (entity.EntityClass == "vPhysXEntity" || entity.EntityClass == "LineFollowerEntity_cl"))
{
entityList.Add(entity);
}
if (parent.HasChildren())
foreach (ShapeBase shape in parent.ChildCollection)
AddPhysXComponentsRecursive(list, entityList, shape);
}
示例3: AddShapesRecursive
void AddShapesRecursive(ShapeCollection target, ShapeBase parent, Rectangle2D selection )
{
if (parent.ShapeVirtualCounter==0 && parent.CanCopyPaste && (parent is Shape3D))
{
Shape3D shape3D = (Shape3D)parent;
if (selection.IsInside(shape3D.x, shape3D.y))
{
target.Add(parent);
//return; // iterate through children as well - the CloneForClipboard will take care of handling duplicates
}
}
if (parent.HasChildren())
{
ShapeCollection children = parent.ChildCollection;
foreach (ShapeBase child in children)
AddShapesRecursive(target, child, selection);
}
}
示例4: GetShapePosAndBox
bool GetShapePosAndBox(ShapeBase shape, out Vector3F pos, out BoundingBox box)
{
if (shape.HasChildren())
{
int iValidCount = 0;
BoundingBox baccum = new BoundingBox();
Vector3F paccum = Vector3F.Zero;
foreach (ShapeBase child in shape.ChildCollection)
{
BoundingBox b1;
Vector3F p1;
if (!GetShapePosAndBox(child, out p1, out b1))
continue;
iValidCount++;
paccum += p1;
if (b1 != null && b1.Valid)
baccum.AddBox(b1);
}
pos = paccum;
box = baccum;
if (iValidCount == 0)
return false;
pos *= (1.0f / (float)iValidCount); // average position
return true;
}
if (shape is Shape3D)
{
pos = ((Shape3D)shape).Position;
box = ((Shape3D)shape).AbsoluteBoundingBox;
if (box == null || !box.Valid)
box = null;
return true;
}
pos = Vector3F.Zero;
box = null;
return false;
}