本文整理汇总了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;
}