本文整理汇总了C#中Bounds.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Bounds.Contains方法的具体用法?C# Bounds.Contains怎么用?C# Bounds.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bounds
的用法示例。
在下文中一共展示了Bounds.Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tile
public Tile(HeatPointList heatPoints, HeatmapSettings settings, Bounds bounds)
{
Bounds = bounds;
Bounds heatMapBounds = new Bounds(bounds);
heatMapBounds.TopLeftLat += settings.Size / 2 * this.DegreesPerPixelLat;
heatMapBounds.TopLeftLng -= settings.Size / 2 * this.DegreesPerPixelLng;
heatMapBounds.BottomRightLat -= settings.Size / 2 * this.DegreesPerPixelLat;
heatMapBounds.BottomRightLng += settings.Size / 2 * this.DegreesPerPixelLng;
HeatPointList pointsWithinBounds = new HeatPointList();
foreach (HeatPoint hp in heatPoints)
{
if (heatMapBounds.Contains(hp)) pointsWithinBounds.Add(hp);
}
HeatMap = new HeatMap(pointsWithinBounds, settings, heatMapBounds);
}
示例2: Update
public void Update()
{
var ml = Game.InputControls.MouseLocation;
if (!ml.HasValue)
return;
var size = Measure();
var pos = new Vector2(Game.ViewportWidth - size.X, Game.ViewportHeight - size.Y) * new Vector2(0.5f, 0.5f);
for (int i = 0; i < Items.Count; i++) {
var item = Items[i];
var itemSize = item.Measure(Game);
var itemBounds = new Bounds(
pos, pos + itemSize
);
if (itemBounds.Contains(ml.Value))
SelectedIndex = i;
pos.Y += itemSize.Y;
}
}
示例3: BoundsCanNotContainAPoint
public void BoundsCanNotContainAPoint()
{
b = new Bounds(Vector3.zero, Vector3.one);
Assert.That(!b.Contains(new Vector3(2, 0, 0)));
}
示例4: IfAPointIntersectsTheBoundsItWillBeContained
public void IfAPointIntersectsTheBoundsItWillBeContained()
{
b = new Bounds(Vector3.zero, Vector3.one);
Assert.That(b.Contains(new Vector3(0.5f, 0.5f, 0.5f)));
}
示例5: BoundsCanContainAPoint
public void BoundsCanContainAPoint()
{
b = new Bounds(Vector3.zero, Vector3.one);
Assert.That(b.Contains(Vector3.zero));
}