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


C# Collider2D.SendMessage方法代码示例

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


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

示例1: OnTriggerStay2D

 void OnTriggerStay2D(Collider2D col)
 {
     if (col.GetComponent<InteractController>() != null && col.GetComponent<InteractController>().message == "") {
         col.SendMessage("GetMessage", this.usestring1 + "\n" + this.usestring2 + "\n" + this.usestring3 + "\n" + this.usestring4);
         col.SendMessage("GetGO", this.gameObject);
     }
 }
开发者ID:ajm1996,项目名称:SpaceSalvage,代码行数:7,代码来源:TextMessageScript.cs

示例2: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.GetComponent<InteractController>() != null) {
         col.SendMessage("GetMessage", this.usestring);
         col.SendMessage("GetGO", this.gameObject);
     }
 }
开发者ID:ajm1996,项目名称:SpaceSalvage,代码行数:7,代码来源:Button.cs

示例3: OnTriggerExit2D

    void OnTriggerExit2D(Collider2D col)
    {
        if (col.GetComponent<InteractController>() != null) {

            col.SendMessage("GetMessage", "");
            col.SendMessage("LoseGO");
        }
    }
开发者ID:ajm1996,项目名称:SpaceSalvage,代码行数:8,代码来源:ExitScript.cs

示例4: OnTriggerEnter2D

    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.GetComponent<InteractController>() != null) {
            col.SendMessage("GetMessage", "Press " + this.usekey.ToString () + " to exit map!");
            col.SendMessage("GetGO", this.gameObject);

        }
    }
开发者ID:ajm1996,项目名称:SpaceSalvage,代码行数:8,代码来源:ExitScript.cs

示例5: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D other) 
	{
		if (_velocity.magnitude > minimumVelocity) 
		{
			other.SendMessage ("Hit", SendMessageOptions.DontRequireReceiver);
			other.SendMessage ("KnockBack", new KnockBackArgs(transform.position,knockBackAmount), SendMessageOptions.DontRequireReceiver);
		}

	}
开发者ID:jab598,项目名称:SEPRAssessment3,代码行数:9,代码来源:KillEnemy.cs

示例6: OnTriggerStay2D

    void OnTriggerStay2D(Collider2D col)
    {
        if (col.gameObject.Equals(Player)){
            if(Player.GetComponent<HealthController>().acceptingOxy && oxygenAmt > 0) {
                oxygenAmt -= 3 * Time.deltaTime;
                col.SendMessage("changeOxy", 10 * Time.deltaTime);
                col.SendMessage("GettingOxy", true);
            }

        }
    }
开发者ID:ajm1996,项目名称:SpaceSalvage,代码行数:11,代码来源:OxygenStation.cs

示例7: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D other) {

		// What direction are we going around the lap?
		var trackDirection = Vector3.Dot(Vector3.Cross(other.transform.position, other.GetComponent<Rigidbody2D>().velocity), new Vector3(0, 0, 1));

		// Only lap if going in the right direction.
		if (trackDirection > 0) {
			other.SendMessage ("AddLap");
		} else {
			other.SendMessage ("RemoveLap");
		}
	}
开发者ID:UNL-Game-Dev,项目名称:Sharks,代码行数:12,代码来源:FinishLine.cs

示例8: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D other){
		if (other.gameObject.tag == "Finish")
			Destroy (gameObject);
		if (other.tag == "Enemy") {
			other.SendMessage ("ApplyDamage", 1);
			Destroy (gameObject);
		}
        if (other.tag == "Player")
        {
            other.SendMessage("Die", 1);
            Destroy(gameObject);
        }
    }
开发者ID:cyberimp,项目名称:Dark-Invaders,代码行数:13,代码来源:BulletController.cs

示例9: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Enemy") {
         other.SendMessage ("Damage", damage);
         other.GetComponent<Rigidbody2D> ().AddForce (new Vector2 (transform.up.x, transform.up.y) * speed, ForceMode2D.Impulse);
     }
 }
开发者ID:tvance989,项目名称:wizard-game,代码行数:7,代码来源:Wave.cs

示例10: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Enemy") {
         other.SendMessage ("Damage", damage * multiplier);
         Destroy (gameObject);
     }
 }
开发者ID:skip-thurm,项目名称:wizard-game,代码行数:7,代码来源:Fireball.cs

示例11: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         other.SendMessage("ApplyGrannyDamage", SendMessageOptions.DontRequireReceiver);
     }
 }
开发者ID:samowski,项目名称:SuperGameProjectofAwesome,代码行数:7,代码来源:CollisionDamage.cs

示例12: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D other)
	{
		switch(other.gameObject.tag)
		{
		default:
			break;
		case "BulletQ":
			Destroy (other.gameObject);
			gameObject.SendMessage("ApplyDamage",1);
			break;
			
		case "BulletW":
			Destroy(other.gameObject);
			Slow ();
			break;
			
		case "BulletE":
			Destroy (other.gameObject);
			gameObject.SendMessage("ApplyDamage",2);
			break;
			
		case "Player":
			other.SendMessage("ApplyDamage");
			Destroy(gameObject);
			break;
			
		}
		
	}
开发者ID:SuperGameJammers,项目名称:SuperColdRevenge,代码行数:29,代码来源:Dragon_Shot.cs

示例13: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D collideObject)
 {
     if (collideObject.gameObject.layer == _playerLayer)
     {
         collideObject.SendMessage("DeathTriggerHit", SendMessageOptions.DontRequireReceiver);
     }
 }
开发者ID:hasaki,项目名称:ragetanks,代码行数:7,代码来源:DeathTrigger.cs

示例14: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D col) {
		if (col.tag == "Player") return;
		//if (col.tag == "Enemy") Destroy(col.gameObject);
		Destroy (this.gameObject);	//col.transform.GetComponent<EnemyScript>().
		if (col.tag == "Enemy") col.transform.GetComponent<EnemyScript>().Death();
		if (col.tag == "Crate") col.SendMessage("DropItem");
	}
开发者ID:CharAlis,项目名称:IndiesVSGamers,代码行数:7,代码来源:BulletScript.cs

示例15: OnTriggerEnter2D

 /**
  *
  */
 public void OnTriggerEnter2D(Collider2D other)
 {
     if (this.IsLit())
     {
         other.SendMessage("OnFlameEnter", this, SendMessageOptions.DontRequireReceiver);
     }
 }
开发者ID:thijsdaniels,项目名称:Metroidvania,代码行数:10,代码来源:Flame.cs


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