本文整理汇总了C#中Pool.CheckInventory方法的典型用法代码示例。如果您正苦于以下问题:C# Pool.CheckInventory方法的具体用法?C# Pool.CheckInventory怎么用?C# Pool.CheckInventory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pool
的用法示例。
在下文中一共展示了Pool.CheckInventory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildRing
private bool BuildRing(Pool segmentPool)
{
if (segments <= segmentPool.CheckInventory())
{
segmentRadians = 2 * Mathf.PI / segments;
bool lastSegmentSkipped = true;
for (int i = 0; i < (segments - 1); i++)
{
if (Random.Range(0, 10) < 2 || i == 0)
{
tempLineSegment = segmentPool.CheckOut();
tempLineSegment.transform.parent = transform;
tempLineSegment.transform.position = transform.position;
tempLineSegment.transform.rotation = Quaternion.identity;
tempLSC = tempLineSegment.GetComponent<LineSegmentController>();
//calculate tempPos1
if (lastSegmentSkipped)
{
tempPos1.x = radius * Mathf.Cos(i * segmentRadians);
tempPos1.y = radius * Mathf.Sin(i * segmentRadians);
}
else
{
tempPos1.x = tempPos3.x;
tempPos1.y = tempPos3.y;
}
//calculate tempPos3
tempPos3.x = radius * Mathf.Cos((i + 1) * segmentRadians);
tempPos3.y = radius * Mathf.Sin((i + 1) * segmentRadians);
//calculate tempPos2
tempPos2.x = (tempPos1.x + tempPos3.x) / 2;
tempPos2.y = (tempPos1.y + tempPos3.y) / 2;
tempLSC.SetPositions(tempPos1, tempPos2, tempPos3);
tempLSC.SetColors(segmentStartColor, segmentEndColor);
tempLSC.SetWidths(segmentStartWidth, segmentEndWidth);
lineSegments.Add(tempLineSegment);
lastSegmentSkipped = false;
}
else
{
lastSegmentSkipped = true;
}
}
return true;
}
else
{
return false;
}
}