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


C# Collider.SendMessage方法代码示例

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


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

示例1: OnTriggerEnter

 //Trigger
 //Using no physics on lazers due to performance load and really don't want it to be too realistic. Lazers should always fire straight.
 void OnTriggerEnter(Collider collidedWith)
 {
     //First a null guard
     if (collidedWith == null || firingPlayer == null)
     {
         return;
     }
     //Now check for things you're supposed to pass through, including friendly fire
     if (collidedWith.tag == "Boundary" || collidedWith.tag == "Crystals" || collidedWith.tag == firingPlayer.tag || collidedWith.tag == "Lazer")
     {
         return;
     }
     //Debug.Log("Collided Tag: " + collidedWith.tag + " and Player Tag: " + firingPlayer.tag);
     //This is to tell the player getting hit. Used for taking health from player getting hit
     collidedWith.SendMessage("Hit", damage);
     collidedWith.SendMessage("CheckForKill", firingPlayer);
     //When the lazer was instantiated it was given a reference to whoever instantiated it, stored in player.
     //Sends a message back to the player to indicate whether or not the bullet hit the enemy
     //The "AddToScore" is a method in the PlayerController script and points is a parameter of that method
     firingPlayer.SendMessage("AddToScore", points);
     //Play the explode animation
     Instantiate(explodeAnimation, surfaceHitPosition, explodeAnimation.transform.rotation);
     //Play the explode sound
     PlayClipAt(audio.clip, surfaceHitPosition);
     //Destroys the lazer gameobject
     Destroy(gameObject);
 }
开发者ID:kalby,项目名称:SpaceCOG-Prototype,代码行数:29,代码来源:ProjectileLazer.cs

示例2: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Enemy"))
        {
            Creep creep = other.GetComponent<Creep>();

            if(creep != null)
            {        
                if (children.Length == 0 )
                {
                    other.SendMessage("OnDespawn", null, SendMessageOptions.DontRequireReceiver);
                }
                else
                {
                    other.SendMessage("OnTargetNode", null, SendMessageOptions.DontRequireReceiver);
                    DirectToNextNode(creep);
                }
            }
        }
        else if(other.CompareTag("Tower"))
        {
            Debug.Log("Danger Value +");
            _dangerValue += 1;
        }

    }
开发者ID:lawnchairgbc,项目名称:immuneWars,代码行数:26,代码来源:CreepTarget.cs

示例3: OnTriggerEnter

    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            col.SendMessage("TakeDamage", 0.2f);
            GameObject efx = Instantiate(hitEfx, transform.position, transform.rotation) as GameObject;
            Destroy(efx, 0.4f);
            Destroy(this.gameObject, 0.1f);

        }

        if (col.gameObject.name.Contains("Plane"))
        {
            GameObject efx = Instantiate(hitEfx, transform.position, Quaternion.identity) as GameObject;
            Destroy(efx, 0.4f);
            Destroy(this.gameObject, 0.1f);
        }

        if (col.gameObject.tag == "Enemy" && col.gameObject != this.gameObject && !thrownByTag.Equals("Enemy")) //prevent self-hit
        {
            col.SendMessage("TakeDamage", 0.5f);
            GameObject efx = Instantiate(hitEfx, transform.position, transform.rotation) as GameObject;
            Destroy(efx, 0.4f);
        }

        sounds.FlaskHit();
    }
开发者ID:AKalbarczyk,项目名称:epg-laboratorynight,代码行数:27,代码来源:RobotThrowableBulletController.cs

示例4: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        if (other.name == "3rd Person Controller")
        {
            other.SendMessage("addDistance", Vector3.Distance(transform.position, other.transform.position));
            other.SendMessage("addObject", this.name);

            }
    }
开发者ID:junezzhu,项目名称:cs426,代码行数:9,代码来源:objectTime.cs

示例5: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if (tag.Equals("exit") && other.tag.Equals("Player"))
         other.SendMessage("exit_triggered", true);
     else if (tag.Equals("teleporter") && other.tag.Equals("Player"))
         other.SendMessage("teleporter_triggered", true);
     else if (tag.Equals("teleporter_boss") && other.tag.Equals("Player"))
         other.SendMessage("teleporter_boss_triggered", true);
 }
开发者ID:OneGameAMonth,项目名称:1gam-dungeon,代码行数:9,代码来源:tile_level_trigger.cs

示例6: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if(other.gameObject.CompareTag ("RightNote")  || other.gameObject.CompareTag ("LeftNote")){
         other.SendMessage("Clickable");
     }
     if(other.gameObject.CompareTag ("End")){
         other.SendMessage("Fading");
     }
 }
开发者ID:dangd169,项目名称:rhythmaction,代码行数:9,代码来源:PressSwitch.cs

示例7: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if (other.isTrigger || (other.GetComponent<TeamMember>() != null && other.GetComponent<TeamMember>().team == team))
         return;
     other.SendMessage("TakeDamage", damage, SendMessageOptions.DontRequireReceiver);
     other.SendMessage("DamageSplat", new ArrayList () {transform.position, vel}, SendMessageOptions.DontRequireReceiver);
     if (penetrations <= 0)
         Destroy(gameObject);
     penetrations --;
 }
开发者ID:Master109,项目名称:MOBA,代码行数:10,代码来源:Bullet.cs

示例8: OnTriggerEnter

	void OnTriggerEnter(Collider other){
		if(other.tag == "Player" || other.tag == "Enemy"){
				other.SendMessage("BombMe", fire.getPlayer());
		}else {
			//Debug.LogWarning(other.tag);
			if(other.tag == "Bomb" || other.tag == "Box" || other.tag == "Invisible")
				other.SendMessage("DestroyMe");
			if(other.tag != "Invisible")
				Destroy(gameObject);
		}
	}
开发者ID:MizzKii,项目名称:WarB,代码行数:11,代码来源:BombSensor.cs

示例9: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Hiro") {
         other.GetComponent<HiroController>().reset();
         other.transform.position = HiroSpawn.position;
         other.SendMessage("SpawnSound");
     } else if (other.tag == "Josie") {
         other.transform.position = JosieSpawn.position;
         other.SendMessage("SpawnSound");
     }
 }
开发者ID:5thFloorGames,项目名称:JosieAndHiro,代码行数:11,代码来源:KillCharacters.cs

示例10: OnTriggerEnter

 public override void OnTriggerEnter(Collider otherObject)
 {
     if (otherObject.gameObject.CompareTag("Player"))
     {
         otherObject.SendMessage("KilledShark");
     }
     if (otherObject.gameObject.CompareTag("enemy"))
     {
         otherObject.SendMessage("BitShark");
     }
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:11,代码来源:SharkBite.cs

示例11: OnTriggerEnter

 void OnTriggerEnter(Collider otro)
 {
     if(otro.name == "Suelo"){
         EliminarDisparo();
     } else if (otro.tag == "Padre"){
         EliminarDisparo();
         otro.SendMessage("MuerePadre", SendMessageOptions.DontRequireReceiver);
     } else if (otro.tag == "Hijo"){
         EliminarDisparo();
         otro.SendMessage("Muere", SendMessageOptions.DontRequireReceiver);
     }
 }
开发者ID:jcastilloprez,项目名称:PDM,代码行数:12,代码来源:Disparo.cs

示例12: OnTriggerEnter

 void OnTriggerEnter(Collider hit)
 {
     if (blockIndex.ToString ().Equals (hit.name.Replace ("Block", "")))
     {
         hit.SendMessage("RightPosition");
         BlockIsRightPlace = true;
     }
     else
     {
         hit.SendMessage("WrongPosition");
         BlockIsRightPlace = false;
     }
 }
开发者ID:joaokucera,项目名称:fifteen-puzzle,代码行数:13,代码来源:BlockCollider.cs

示例13: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        float currentX = transform.position.x;

        if (other.tag == "Player")
        {
            other.SendMessage("touchLineAndStop", currentX);
            if (isLeftEnd)
                other.SendMessage("touchLeftEnd");
            else if (isRightEnd)
                other.SendMessage("touchRightEnd");
        }
    }
开发者ID:Mattys410305,项目名称:Magical-Girl-Shop,代码行数:13,代码来源:Line.cs

示例14: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if(other.gameObject.CompareTag("Enemy") && !isEnemy)
     {
         other.SendMessage("Damage", damage);
         Instantiate(hit,transform.position,transform.rotation);
         Destroy(this.gameObject);
     }
     else if (other.gameObject.CompareTag("Friend") && isEnemy)
     {
         other.SendMessage("Damage", damage);
         Instantiate(hit, transform.position, transform.rotation);
         Destroy(this.gameObject);
     }
 }
开发者ID:James510,项目名称:Superluminal,代码行数:15,代码来源:BulletScript.cs

示例15: OnTriggerEnter

 public void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Player")
     {
         collider.SendMessage("PickUpRune", gameObject);
     }
 }
开发者ID:worthingtonjg,项目名称:RelicHunter,代码行数:7,代码来源:RuneDetection.cs


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