本文整理匯總了C#中UnityEngine.Collider.GetComponentInChildren方法的典型用法代碼示例。如果您正苦於以下問題:C# Collider.GetComponentInChildren方法的具體用法?C# Collider.GetComponentInChildren怎麽用?C# Collider.GetComponentInChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEngine.Collider
的用法示例。
在下文中一共展示了Collider.GetComponentInChildren方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnTriggerStay
void OnTriggerStay(Collider other)
{
if (other.gameObject.tag == "Player")
{
other.GetComponentInChildren<PlayerShooting>().BounceTimer = 0;
Destroy(gameObject, 1);
}
}
示例2: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
// If the entering collider is the player...
if (other.tag == "Player")
{
PlayerShooting playerShooting = other.GetComponentInChildren<PlayerShooting>();
if (playerShooting != null)
{
playerShooting.AddAmmo(ARTIFACT_AMOUNT);
Destroy(gameObject);
}
}
}
示例3: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player1_") || other.CompareTag("Player2_") || other.CompareTag("Player3_") || other.CompareTag("Player4_"))
{
ShipPartDestroy partScript = other.GetComponentInParent<ShipPartDestroy>();
if (partScript != null)
{
// Found in parent, repair
partScript.RepairAllParts();
}
else
{
// Look to children for the part object
partScript = other.GetComponentInChildren<ShipPartDestroy>();
if (partScript != null)
{
partScript.RepairAllParts();
}
}
}
}
示例4: OnTriggerExit
void OnTriggerExit(Collider other) {
Text text = other.GetComponentInChildren<Text> ();
if (text == null) { return; }
text.color = textColor;
}
示例5: OnTriggerStay
void OnTriggerStay(Collider other){
Text text = other.GetComponentInChildren<Text>();
if (text == null) { return; }
text.color = Color.white;
CurrentHilightValue = text.text;
}
示例6: OnTriggerEnter
void OnTriggerEnter(Collider other) {
// TODO: There should be no need for a collider on labels to derive a highlight.
Text text = other.GetComponentInChildren<Text>();
if (text == null) { return; }
text.color = Color.white;
}