本文整理汇总了C#中Collider类的典型用法代码示例。如果您正苦于以下问题:C# Collider类的具体用法?C# Collider怎么用?C# Collider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Collider类属于命名空间,在下文中一共展示了Collider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerEnter
public void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == Tags.PLAYER)
{
PlayerMechanic player = other.gameObject.GetComponent<PlayerMechanic>();
switch(playerState)
{
case PlayerState.ScaryDogMode:
rigidbody.AddForce(xJumpForce * 2, yJumpForce, 0);
death = true;
AudioPlayer.Play(AudioPlayer.PLAYER_WOOF);
break;
case PlayerState.BoostMode:
rigidbody.AddForce(xJumpForce * 2, yJumpForce, 0);
death = true;
AudioPlayer.Play(AudioPlayer.CAT_DAMAGED);
break;
case PlayerState.Normal:
player.GameOver();
break;
case PlayerState.LaserMode:
if(!zonzo)
player.GameOver();
break;
}
}
}
示例2: OnTriggerExit
void OnTriggerExit(Collider OtherCollider)
{
//StartCoroutine(MoveFromTo(Door1, Door1.position - new Vector3(0,0,2), moveTime));
//StartCoroutine(MoveFromTo(Door2, Door2.position + new Vector3(0,0,2), moveTime));
moving = true;
open = false;
}
示例3: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
Destroy(gameObject);
}
}
示例4: OnTriggerEnter
public void OnTriggerEnter(Collider c)
{
var g = c.gameObject;
if( g == null) return;
if( g.CompareTag("Enemy") ) {
var roman = g.GetComponent<RomanMovement>();
var pickup = g.GetComponent<Pickup>();
if( roman != null ) {
var collision = RomanCollision(this, this.pickup_, roman, pickup) ||
RomanCollision(roman, pickup, this, this.pickup_);
if( collision ) {
this.audio_.PlayOneShot(this.SndCollision);
}
}
}
else if( g.CompareTag("Player") ) {
if( this.pickup_.IsBeingThrown ) return;
if( this.pickup_.IsPickedUp ) return;
// Debug.Log ("Player died");
this.audio_.PlayOneShot(this.SndPlayerDeath);
Destroy(g);
}
}
示例5: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("box")) {
moveGate = true;
}
}
示例6: Pegarse
public override void Pegarse(Collider other)
{
SoundManager.soundManagerRef.audioCoger.Play();
transform.forward = other.transform.position - transform.position;
transform.parent = other.transform;
//transform.localPosition = Vector3.zero;
}
示例7: OnTriggerExit
void OnTriggerExit(Collider other)
{
// If the player leaves the trigger zone...
if (other.gameObject == player)
// ... the player is not in sight.
playerInSight = false;
}
示例8: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (other.name == "NecroHalo")
{
isBuffed = true;
}
}
示例9: OnTriggerExit
void OnTriggerExit(Collider other)
{
if (other.name == "NecroHalo")
{
isBuffed = false;
}
}
示例10: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (tag == "" || other.gameObject.CompareTag(tag))
{
NextLevel();
}
}
示例11: OnTriggerEnter
void OnTriggerEnter(Collider c)
{
if (c.tag == "Ground") {
// Set rigidbody of shells to sleep when they touch the ground, so the shells will stop wobbling around at eat the performance.
GetComponent<Rigidbody>().Sleep();
}
}
示例12: OnTriggerEnter
void OnTriggerEnter(Collider objC)
{
switch (ZoneType)
{
case ZoneType.DeathZone:
if (objC.CompareTag("Sphere"))
{
objC.transform.parent.GetComponent<Sphere>().YouDeadBro();
}
else if (string.Equals(objC.gameObject.name, "ZoneCollider"))
{
objC.transform.parent.gameObject.GetComponent<Box>().YouDeadBro();
ZoneType = ZoneType.Walkable;
}
break;
case ZoneType.Walkable:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
示例13: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
StartCoroutine(FadeOnTp(other.gameObject, GameObject.Find("Main Camera")));
}
}
示例14: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("PickUp")) {
other.gameObject.SetActive(false);
setCount(count += 1);
}
}
示例15: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (damagingTags.IndexOf (other.tag) >= 0) {
addHitPoints (-other.gameObject.GetComponent<Damaging> ().damage);
if (explosion) {
Instantiate (explosion, transform.position + new Vector3 (0, 0, 1), transform.rotation);
}
if (sound) {
AudioSource.PlayClipAtPoint (sound, transform.position);
}
if (hitPoints.Value <= 0) {
BroadcastMessage ("DoKill", null, SendMessageOptions.DontRequireReceiver);
}
if (damageIndicator) {
Color cl = damageIndicator.color;
damageIndicator.color = new Color (cl.r, cl.g, cl.b, 1.0f);
}
} else if (pickupTags.IndexOf (other.tag) >= 0) {
// other.GetComponent<PickUp> ().apply (this);
Debug.Log ("PickUp: " + other.tag);
}
}