當前位置: 首頁>>代碼示例>>C#>>正文


C# Collider.GetComponentInChildren方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:csethanhcong,項目名稱:game3d-unity,代碼行數:8,代碼來源:BounceBulletItem.cs

示例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);
                }
            }
        }
開發者ID:gilgulim,項目名稱:KillThemAllUnity_Version2,代碼行數:14,代碼來源:AmmoCollected.cs

示例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();
                    }
                }

            }
        }
開發者ID:patferguson,項目名稱:Storms-Project,代碼行數:22,代碼來源:HealPointBehaviour.cs

示例4: OnTriggerExit

 	void OnTriggerExit(Collider other) {
     Text text = other.GetComponentInChildren<Text> ();
     if (text == null) { return; }
     text.color = textColor;
 	}
開發者ID:fufu70,項目名稱:knighthacksoculeap,代碼行數:5,代碼來源:HilightTextVolume.cs

示例5: OnTriggerStay

 	void OnTriggerStay(Collider other){
 		Text text = other.GetComponentInChildren<Text>();
     if (text == null) { return; }
 		text.color = Color.white;
 		CurrentHilightValue = text.text;
 	}
開發者ID:fufu70,項目名稱:knighthacksoculeap,代碼行數:6,代碼來源:HilightTextVolume.cs

示例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;
 	}
開發者ID:fufu70,項目名稱:knighthacksoculeap,代碼行數:6,代碼來源:HilightTextVolume.cs


注:本文中的UnityEngine.Collider.GetComponentInChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。