本文整理汇总了C#中Recipe.clearPieces方法的典型用法代码示例。如果您正苦于以下问题:C# Recipe.clearPieces方法的具体用法?C# Recipe.clearPieces怎么用?C# Recipe.clearPieces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Recipe
的用法示例。
在下文中一共展示了Recipe.clearPieces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: combine
public void combine(Recipe recipe) {
List<GameObject> checklist = recipe.getPieces();
foreach (GameObject item in checklist) {
Destroy(item);
comboItems.Remove(item);
//blockCount--;
}
recipe.clearPieces();
GameObject piece = recipe.outputResult();
piece = (GameObject) GameObject.Instantiate(piece, new Vector3(transform.position.x, transform.position.y + piece.renderer.bounds.size.y / 2, transform.position.z), Quaternion.identity);
piece.rigidbody.AddForce(Vector3.zero);
GameObject.FindGameObjectWithTag("Player").rigidbody.AddForce(Vector3.zero);
}
示例2: checkRecipe
private bool checkRecipe(Recipe recipe) {
List<GameObject> blocks; // Blocks that satisfy a requirement.
recipe.clearPieces();
foreach (ConTuple reqs in recipe.reqObjs) {
if (recipe.sizeStrict)
blocks = comboItems.Where(obj => obj.GetComponent<ConstructionPiece>().bldgMat == reqs.material && obj.GetComponent<ConstructionPiece>().blockSize == reqs.size).ToList<GameObject>();
else
blocks = comboItems.Where(obj => obj.GetComponent<ConstructionPiece>().bldgMat == reqs.material && obj.GetComponent<ConstructionPiece>().blockSize >= reqs.size).ToList<GameObject>();
if (blocks.Count >= reqs.numReq) {
for (int i = 0; i < reqs.numReq; i++)
recipe.addPiece(blocks[i]);
blocks.Clear();
} else {
return false;
}
}
return true;
}