本文整理汇总了C#中Ingredient.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Ingredient.GetComponent方法的具体用法?C# Ingredient.GetComponent怎么用?C# Ingredient.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ingredient
的用法示例。
在下文中一共展示了Ingredient.GetComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveTo
public void MoveTo(Ingredient ingredient, Transform t, TweenCallback callback)
{
//Should tween
//ingredient.transform.position = t.position;
ingredient.GetComponent<Rigidbody>().DOMove(t.position, 1f).OnComplete(callback);
ingredient.GetComponent<Rigidbody>().velocity = Vector3.zero;
}
示例2: Grab
public void Grab(Ingredient ingredient)
{
if (heldIngredient != null)
{
//derp, git change
ReleaseWithForce();
}
heldIngredient = ingredient;
heldIngredient.GetComponent<Rigidbody>().useGravity = false;
heldIngredient.GetComponent<Collider>().enabled = false;
MoveTo(ingredient, transform);
}
示例3: RemoveIngredient
public void RemoveIngredient(Ingredient ingredient)
{
if (curIngredients.Contains(ingredient))
{
ingredient.GetComponent<Rigidbody>().isKinematic = false;
curIngredients.Remove(ingredient);
ingredient.onSelect = delegate () { };
}
}
示例4: AddIngredient
public void AddIngredient(Ingredient ingredient)
{
if (curIngredients.Count >= ingredientSpots.Count)
{
PlayerHand.Instance.DropIngredient();
return;
}
int numI = curIngredients.Count;
ingredient.GetComponent<Collider>().enabled = false;
PlayerHand.Instance.MoveTo(ingredient, ingredientSpots[numI],delegate()
{
//ingredient.transform.SetParent(ingredientSpots[numI]);
ingredient.transform.position = ingredientSpots[numI].position;
ingredient.GetComponent<Collider>().enabled = true;
ingredient.GetComponent<Rigidbody>().isKinematic = true;
});
curIngredients.Add(ingredient);
ingredient.onSelect += delegate ()
{
RemoveIngredient(ingredient);
};
}
示例5: FinishPrep
public void FinishPrep()
{
// anim.SetTrigger(boilhash);
product = MasterIngredientList.Instance.CombineIngredients(curIngredients, method);
product.transform.position = ingredientSpots[0].position;
Debug.Log("Done prepping!"+product.name);
Vector3 towardsZero = (Camera.main.transform.position - transform.position).normalized;
towardsZero.y += 0.2f;
product.GetComponent<Rigidbody>().AddForce(towardsZero * 0.3f);
ClearIngredients();
if (animEffect != null)
{
animEffect.SetActive(false);
}
}