本文整理汇总了C#中Body.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Body.Remove方法的具体用法?C# Body.Remove怎么用?C# Body.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSaveVisibility
public void TestSaveVisibility()
{
var root = new Body
{
Location = new Frame3D(10, 0, 0)
};
Body box = new Box
{
Location = new Frame3D(10, 20, 30)
};
root.Add(box);
var lo = new LoggingObject(box, root);
lo.SaveVisibilityState(_totalTime);
Assert.AreEqual(1, lo.VisibilityStates.Count);
Assert.AreEqual(_totalTime, lo.VisibilityStates[0].StartTime);
_totalTime ++;
lo.SaveVisibilityState(_totalTime);
Assert.AreEqual(1, lo.VisibilityStates.Count);
Assert.AreEqual(true, lo.VisibilityStates[0].IsVisible);
root.Remove(box);
_totalTime++;
lo.SaveVisibilityState(_totalTime);
Assert.AreEqual(_totalTime, lo.VisibilityStates.Last().StartTime);
Assert.AreEqual(2, lo.VisibilityStates.Count);
Assert.AreEqual(false, lo.VisibilityStates.Last().IsVisible);
}
示例2: Apply
public void Apply(Body loadedBody, Body world)
{
if(IsVisible)
world.Add(loadedBody);
else
world.Remove(loadedBody);
}
示例3: Grip
private void Grip(ICvarcEngine engine, Body Body)
{
var gripped = Body.ToList();
if (gripped.Any()) return;
var found = Body.TreeRoot.GetSubtreeChildrenFirst().FirstOrDefault(a => CanBeAttached(Body, a) && (a.Parent.Id == a.TreeRoot.Id));
if (found != null)
{
Body latestGripped = null;
var oldGrippedCount = gripped.Count;
if (oldGrippedCount > 0)
{
latestGripped = gripped.Last();
if (found.DefaultColor != latestGripped.DefaultColor)
return;
}
var tempfound = found;
while (tempfound.Any())
{
tempfound = tempfound.FirstOrDefault();
gripped.Add(tempfound);
}
if (oldGrippedCount > 0)
{
Body.Remove(latestGripped);
if (latestGripped != null)
{
latestGripped.Location = new Frame3D(0, 0, 8, Angle.Zero, Angle.Zero, Angle.Zero);
tempfound.Add(latestGripped);
}
}
CaptureDevicet(Body, found);
gripped.Add(found);
}
}
示例4: Release
private void Release(ICvarcEngine engine, Body Body)
{
var latestGripped = Body.FirstOrDefault(z => z.Type.StartsWith("D") && z.Type.Length == 2);
if (latestGripped == null) return;
var absoluteLocation = latestGripped.GetAbsoluteLocation();
Body.Remove(latestGripped);
latestGripped.FrictionCoefficient = frictionCoefficientsById.SafeGet(latestGripped.Id);
var targetColor = latestGripped.Type[1].ToString();
latestGripped.Location = absoluteLocation;
latestGripped.Velocity = Body.Velocity;
var toAtt = Body.TreeRoot.GetSubtreeChildrenFirst()
.Where(a =>
(a.Type == "VW" + targetColor || a.Type == "HW" + targetColor) &&
Distance(latestGripped, a) < 30)
.OfType<Box>()
.FirstOrDefault();
if (toAtt != null)
{
Body.TreeRoot.Remove(toAtt);
var wall = new Box
{
Type = toAtt.Type.Substring(0, 2),
XSize = toAtt.XSize,
YSize = toAtt.YSize,
ZSize = toAtt.ZSize,
Location = toAtt.Location,
DefaultColor = SRCompetitions.WallColor,
IsStatic = true,
IsMaterial = true
};
Body.TreeRoot.Add(wall);
engine.RaiseOnCollision(Body.Id.ToString(), toAtt.Id.ToString(), GetCollisionType(targetColor));
}
else
Body.TreeRoot.Add(latestGripped);
// gripped.RemoveRange(0, gripped.Count);
}