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


C# Collider2D.SendMessageUpwards方法代码示例

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


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

示例1: OnTriggerStay2D

	void OnTriggerStay2D(Collider2D col){
		if (col.CompareTag ("Door")) { // Player activated door
			if (in_crouch > 0){
				col.SendMessageUpwards("MovePlayerDown");
			}else if (in_jump > 0){
				col.SendMessageUpwards("MovePlayerUp");
			}
			GetComponent<Collider2D>().enabled = false;
		}
	}
开发者ID:cooperdombeck,项目名称:Stuff,代码行数:10,代码来源:ActionTrigger.cs

示例2: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.isTrigger != true && col.CompareTag ("Enemy")) {
         col.SendMessageUpwards("AttackEnemy", dmg);
         col.gameObject.GetComponent<Rigidbody2D> ().AddForce (new Vector2 (4, 0) * 500.0f);
     }
     else if (col.isTrigger != true && col.CompareTag ("FlyEnemy")) {
         col.SendMessageUpwards("AttackEnemy", dmg);
         col.SendMessage("Attacked");
     }
 }
开发者ID:willedanielsson,项目名称:SlasherBoy,代码行数:11,代码来源:attackTrigger.cs

示例3: OnTriggerStay2D

	void OnTriggerStay2D(Collider2D other){
		if (timer <= Time.time) { 
			if (other.tag == "Player") {
				other.SendMessageUpwards ("takeDamage", 5, SendMessageOptions.DontRequireReceiver);
				timer = Time.time + 1.5f;
			}
			if (other.tag == "Enemy") {
				other.SendMessageUpwards ("takeDamage", 1, SendMessageOptions.DontRequireReceiver);
				timer = Time.time + 1.0f;
			}
		}
	}
开发者ID:majorTomi,项目名称:luolapeli,代码行数:12,代码来源:Trap_fire.cs

示例4: OnTriggerEnter2D

    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.isTrigger != true && col.CompareTag("Enemy"))
       
        {
            col.SendMessageUpwards("adjustHealth", transform.parent.GetComponent<playerAttack>().damage);
            
            
        }

        if (col.isTrigger != true && col.CompareTag("Player"))
        {
            col.SendMessageUpwards("adjustHealth", transform.parent.GetComponent<ZombieAI>().damage);
            
        }
    }
开发者ID:levchCode,项目名称:12HoursGame,代码行数:16,代码来源:AttackTrigger.cs

示例5: OnTriggerEnter2D

 public override void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag ("Player")) {
      SwitchBodies();
      other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
       }
 }
开发者ID:MeesterMarcus,项目名称:Adv-Soft-Engineering-Project,代码行数:7,代码来源:Boss3.cs

示例6: OnTriggerEnter2D

	/*void update(){
		direction = MovePlayer.anim.GetInteger ("Direction");
		if (direction == 0) {
			transform.position
		}
	}*/
	void OnTriggerEnter2D (Collider2D col){
		/*animSlash.SetBool("Attak",true);*/
		if (col.isTrigger !=true)
        {
            col.SendMessageUpwards("Damage", dmg);
        }
    }
开发者ID:Weavel35,项目名称:GGJ16-Notice-Me-Lord-Satanus,代码行数:13,代码来源:AttackTrigger.cs

示例7: PostOnTriggerEnter2D

 protected override void PostOnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag ("Player")) {
         other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
         DestroyObject();
     }
 }
开发者ID:MeesterMarcus,项目名称:Adv-Soft-Engineering-Project,代码行数:7,代码来源:EnemyProjectileScript.cs

示例8: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D col)
	{
		if (col.isTrigger == true && col.CompareTag("Enemy"))
		{
            col.SendMessageUpwards("Damage", dmg);
		}
	}
开发者ID:teammeeseeks,项目名称:liveordiabetes,代码行数:7,代码来源:AttackTrigger.cs

示例9: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.isTrigger != true && col.CompareTag("Enemy"))
     {
         col.SendMessageUpwards("takingHITS", dmg);
     }
 }
开发者ID:guilebarbosa,项目名称:thephantommasquerade,代码行数:7,代码来源:AttackTriggerScrpit.cs

示例10: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         //Debug.Log("Enemy collided with player", gameObject);
         other.SendMessageUpwards ("ApplyDamage", damageValue, SendMessageOptions.DontRequireReceiver);
     }
 }
开发者ID:MeesterMarcus,项目名称:Adv-Soft-Engineering-Project,代码行数:8,代码来源:fireMidBoss.cs

示例11: OnTriggerEnter2D

 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player") {
         audio.Play();
         other.SendMessageUpwards("consumedItem", this);
         StartCoroutine(DestroyAfterAudio());
     }
 }
开发者ID:Tehnix,项目名称:TowerOfPower,代码行数:8,代码来源:Item.cs

示例12: OnTriggerStay2D

    protected bool pierceEnemies; // Pierces through enemiess

    #endregion Fields

    #region Methods

    protected virtual void OnTriggerStay2D(Collider2D other)
    {
        PreOnTriggerStay2D (other);
        if (incrementDamage == true) {
            if (other.CompareTag("Enemy"))
                other.SendMessageUpwards ("ApplyDamage", damage * Time.deltaTime, SendMessageOptions.DontRequireReceiver);
        }
        PostOnTriggerStay2D (other);
    }
开发者ID:MeesterMarcus,项目名称:Adv-Soft-Engineering-Project,代码行数:15,代码来源:PlayerProjectileScript.cs

示例13: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D col){

		direction = (player.GetComponent<PlayerMovement>().facingRight ? 1 : -1);
		
		if (col.isTrigger != true && col.CompareTag ("Enemy")) {
			col.SendMessageUpwards("MeleeDamage", damage*direction);
			GetComponent<Collider2D>().enabled = false;
		}
	}
开发者ID:cooperdombeck,项目名称:Stuff,代码行数:9,代码来源:MeleeTrigger.cs

示例14: onTriggerEnter2D

 void onTriggerEnter2D(Collider2D col)
 {
     Debug.Log("collision1");
     if (col.isTrigger != true && col.CompareTag("Enemy"))
     {
         col.SendMessageUpwards("attacking", jabDamage);
         Debug.Log("collision");
     }
 }
开发者ID:cajasj,项目名称:Beat-Boxer,代码行数:9,代码来源:jabTrigger.cs

示例15: OnTriggerEnter2D

	void OnTriggerEnter2D(Collider2D other)
	{
		if(other.gameObject.CompareTag("Player2"))
		{
			other.SendMessageUpwards("Player 1 attacks Player 2");
			Debug.Log( "collide (name) : " + other.gameObject.name );
			Debug.Log( "collide (tag) : " + other.gameObject.tag );
		}
	}
开发者ID:mamelend,项目名称:spacegumbo,代码行数:9,代码来源:attackTrigger.cs


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