当前位置: 首页>>代码示例>>C#>>正文


C# Collider.GetComponentsInChildren方法代码示例

本文整理汇总了C#中Collider.GetComponentsInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Collider.GetComponentsInChildren方法的具体用法?C# Collider.GetComponentsInChildren怎么用?C# Collider.GetComponentsInChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collider的用法示例。


在下文中一共展示了Collider.GetComponentsInChildren方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTriggerEnter

    void OnTriggerEnter(Collider col)
    {
        if (col.tag.Equals("Player"))
        {
            Renderer rend = col.GetComponentsInChildren<Renderer>()[0];
            rend.material.SetColor("_Color", this.currentColor);

            Light light = col.GetComponentsInChildren<Light>()[0];
            light.color = this.currentColor;
        }
    }
开发者ID:kw0006667,项目名称:The-Colors-Boy,代码行数:11,代码来源:ColorSwitch.cs

示例2: RevealObj

 public void RevealObj(Collider collider, bool reveal)
 {
     if (!reveal && (visibleEnemies.Contains(collider) || ((collider.GetComponent<TeamMember>().team.name == "GreenTeam" && NonPlayerVision.visibleGreenUnits.Contains(collider)) || (collider.GetComponent<TeamMember>().team.name == "RedTeam" && NonPlayerVision.visibleRedUnits.Contains(collider)))))
         return;
     foreach (Renderer r in collider.GetComponentsInChildren<Renderer>())
         r.enabled = reveal;
 }
开发者ID:Master109,项目名称:MOBA,代码行数:7,代码来源:Player_Vision.cs

示例3: OnTriggerEnter

 // Flash when triggered.
 void OnTriggerEnter(Collider collider)
 {
     entered = true;
     brightTimer = BrightTime;
     //GameObject portal = GameObject.Find("Portal").GetComponent<Grower>().rate = -500;
     Destroy(GameObject.Find("Clouds"));
     foreach (Renderer renderer in collider.GetComponentsInChildren<Renderer>())
         renderer.enabled = false;
 }
开发者ID:mokacao,项目名称:StellarSwingClassic,代码行数:10,代码来源:Flash.cs

示例4: OnTriggerEnter

	void OnTriggerEnter(Collider other) {
		if (other.tag == "Player"  && !isHeld) {
			isHeld = true;
			activePlayerCamera = other.GetComponentsInChildren<Camera>()[0];
			transform.parent = activePlayerCamera.transform;
			rigidBody.isKinematic = true;
			transform.localPosition = new Vector3(0f, -0.6f, 0.6f);
		}
	}
开发者ID:peasandwell,项目名称:PheonixOculus,代码行数:9,代码来源:PickAndThrow.cs

示例5: OnTriggerEnter

    void OnTriggerEnter(Collider collider)
    {
        _collider = collider;
        StopCoroutine("CountdownTimer");
        foreach (var componentsInChild in collider.GetComponentsInChildren<Thruster>())
        {
            componentsInChild.ControlsReversed = true;
        }

        if (_coroutineRunning == false)
            _countDownTimer = StartCoroutine("CountdownTimer");
    }
开发者ID:BraveSirAndrew,项目名称:DublinGameCraft6,代码行数:12,代码来源:ReverseControlsRegion.cs

示例6: OnTriggerEnter

    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Patrol" && getWaypoints)
        {
            Transform[] objects = col.GetComponentsInChildren<Transform>();
            for (int i = 0; i < objects.Length; i++)
            {
                if (objects[i].tag == "Waypoint")
                {
                    Waypoints.Add(objects[i].transform);
                }

            }
            getWaypoints = false;
        }
    }
开发者ID:miojow,项目名称:AwaysWatching,代码行数:16,代码来源:Agressive.cs

示例7: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
         if(enemies.Length == 0)
         {
             Renderer[] PlayerRenderers = other.GetComponentsInChildren<Renderer>();
             foreach (Renderer playerRenderer in PlayerRenderers)
             {
                 playerRenderer.enabled = false;
             }
             CoinCounter.Win = true;
         }
         else
         {
             foreach (var enemy in enemies)
             {
                 Debug.Log(enemy.name);
             }
         }
     }
 }
开发者ID:CTMarak,项目名称:CMP150,代码行数:23,代码来源:FinishLine.cs

示例8: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Body") && other.GetComponentInChildren<Spirit>())
        {
            Component[] spirits = other.GetComponentsInChildren<Spirit>();
            GameObject spirit;
            foreach(Component c in spirits)
            {
                spirit = c.gameObject;
                if (spirit.GetComponent<SingingSpirit>())
                    ((DragonAI)GameMaster.GM.dragon.GetComponent<DragonAI>()).stopSinging();
                freeSpririt(spirit.GetComponent<Spirit>().value, (int)spirit.GetComponent<Spirit>().spiritType);
                GameMaster.GM.spirits.Remove(spirit);
                GameMaster.GM.spiritCount--;
                Destroy(spirit);

                nbBlueSpirit = 0;
                pointer.target = null;

                snakeAI.nbSpiritGathered = 0;
                snakeAI.nbSpiritIndicator.value = .0f;
            }
        }
    }
开发者ID:Coubas,项目名称:Slice_of_Sky,代码行数:24,代码来源:SpiritGate.cs

示例9: OnTriggerStay

 void OnTriggerStay( Collider collider )
 {
     if( collider.gameObject != CurrentActionArea && collider.GetComponentsInChildren<ActionArea>().Length > 0 ) {
         CurrentActionArea = collider.gameObject;
     } else if( collider.tag.Equals( "Jelly" ) && !beingDamaged && Health > 0 ) {
         beingDamaged = true;
         damagedParticleSystem.particleSystem.Play();
     }
 }
开发者ID:bdjones,项目名称:GGJ13,代码行数:9,代码来源:Player.cs


注:本文中的Collider.GetComponentsInChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。