本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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");
}
示例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;
}
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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();
}
}