Beispiel #1
0
	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;
		}
	}
 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");
     }
 }
Beispiel #3
0
	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;
			}
		}
	}
Beispiel #4
0
    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);
            
        }
    }
 public override void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag ("Player")) {
      SwitchBodies();
      other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
       }
 }
	/*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);
        }
    }
 protected override void PostOnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag ("Player")) {
         other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
         DestroyObject();
     }
 }
	void OnTriggerEnter2D(Collider2D col)
	{
		if (col.isTrigger == true && col.CompareTag("Enemy"))
		{
            col.SendMessageUpwards("Damage", dmg);
		}
	}
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.isTrigger != true && col.CompareTag("Enemy"))
     {
         col.SendMessageUpwards("takingHITS", dmg);
     }
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         //Debug.Log("Enemy collided with player", gameObject);
         other.SendMessageUpwards ("ApplyDamage", damageValue, SendMessageOptions.DontRequireReceiver);
     }
 }
Beispiel #11
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player") {
         audio.Play();
         other.SendMessageUpwards("consumedItem", this);
         StartCoroutine(DestroyAfterAudio());
     }
 }
    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);
    }
Beispiel #13
0
	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;
		}
	}
Beispiel #14
0
 void onTriggerEnter2D(Collider2D col)
 {
     Debug.Log("collision1");
     if (col.isTrigger != true && col.CompareTag("Enemy"))
     {
         col.SendMessageUpwards("attacking", jabDamage);
         Debug.Log("collision");
     }
 }
Beispiel #15
0
	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 );
		}
	}
Beispiel #16
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag.Equals ("Enemy")) {
         other.SendMessageUpwards ("Damaged");
         GameObject hit = (GameObject)Instantiate(Resources.Load("HitEffect"));
         hit.transform.position = gameObject.transform.position;
         hit.transform.Translate (new Vector3(0.2f, 0.37f, 0));
         Destroy(gameObject);
     }
 }
Beispiel #17
0
 // Teleport the player to the destination when he enters the trigger area
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player") {
         if (this.npcThatUnlocks != null) {
             if (this.npcThatUnlocks.defeated) {
                 other.SendMessageUpwards("teleport", this);
             } else {
                 string[] text = new string[] { this.npcMustBeDefatedMsg };
                 StartCoroutine(GameEventManager.conversation.speak(text));
             }
         } else {
             if (GameEventManager.player.reputation() >= this.repNeededToUse) {
                 other.SendMessageUpwards("teleport", this);
             } else {
                 string[] text = new string[] { "Sorry, You need " + this.repNeededToUse + " reputation to go here!" };
                 StartCoroutine(GameEventManager.conversation.speak(text));
             }
         }
     }
 }
 void OnTriggerEnter2D(Collider2D col)
 {
     //Debug.Log("col.isTrigger");
     //Debug.Log(col.isTrigger);
     //Debug.Log("col.CompareTag(Enemy)");
     //Debug.Log(col.CompareTag("Enemy"));
     if (col.isTrigger != true && col.CompareTag("Enemy"))
     {
         Debug.Log("Enemy");
         col.SendMessageUpwards("Damage", dmg);
     }
 }
 void OnTriggerEnter2D(Collider2D col)
 {
     if(col.isTrigger != true && col.CompareTag ("Enemy"))
     {
         GameObject wh;
         float x = Random.Range(col.transform.position.x-(col.bounds.size.x/2),col.transform.position.x+(col.bounds.size.x/2));
         float y = Random.Range(col.transform.position.y-(col.bounds.size.y/2),col.transform.position.y+(col.bounds.size.y/2));
         Vector3 pos = new Vector3(x,y,player.transform.position.z);
         wh = Instantiate(whiphit, pos, player.transform.rotation) as GameObject;
         col.SendMessageUpwards("Damage",dmg);
     }
 }
    protected override void PostOnTriggerEnter2D(Collider2D other)
    {
        if (incrementDamage == false) {
            if (other.CompareTag ("Enemy")) {
                other.SendMessageUpwards ("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);

                if (pierceEnemies != true) {
                    myTr.GetComponent<Collider2D> ().enabled = false;
                    StartCoroutine (DestroyObject ());
                }
            }
        }
    }
Beispiel #21
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (!col.isTrigger)
     {
         if (col.CompareTag("Player") || col.CompareTag("Enemy"))
         {
             col.SendMessageUpwards("Damage", 1);
         }
         Destroy(gameObject);
     }
     else
     {
     }
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "VibrationTrigger") {
         GamePad.SetVibration(PlayerIndex.One, 1.0f, 1.0f);
     }
     else if(other.tag == "DodgeObjectSuccess") {
         isInDodgeArea = true;
         dodgeObject = other;
     }
     else if(other.tag == "DodgeObjectFailure") {
         other.SendMessageUpwards("OnDodgeFailure");
     }
     else if(other.tag == "MashingArea") {
         other.SendMessage("InMashingArea");
     }
     else if(other.tag == "GameOver") {
         EventManager.SendMessage("OnGameOver");
     }
     else if(other.tag == "Egg") {
         Application.LoadLevel("LevelComplete");
     }
 }
    void OnTriggerEnter2D(Collider2D col)
    {
        if(GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().bonus==3)
        {
            dmg*=2;
        }

        if(col.isTrigger != true &&( col.CompareTag ("Enemy")||col.CompareTag ("Boss")))
        {
            GameObject wh;
            float x = Random.Range(col.transform.position.x-(col.bounds.size.x/2),col.transform.position.x+(col.bounds.size.x/2));
            float y = Random.Range(col.transform.position.y-(col.bounds.size.y/2),col.transform.position.y+(col.bounds.size.y/2));
            Vector3 pos = new Vector3(x,y,player.transform.position.z);
            wh = Instantiate(whiphit, pos, player.transform.rotation) as GameObject;
            col.SendMessageUpwards("Damage",dmg);
        }

        if(GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().bonus==3)
        {
            dmg/=2;
        }
    }
Beispiel #24
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if(GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().bonus==3)
     {
         dmg*=2;
     }
     if (col.isTrigger != true) {
         if(col.CompareTag ("Enemy")||col.CompareTag ("Boss"))
         {
             col.SendMessageUpwards("Damage",dmg);
             Destroy(gameObject);
         }
         if(col.CompareTag("Floor"))
         {
             Destroy(gameObject);
         }
     }
     if(GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().bonus==3)
     {
         dmg/=2;
     }
 }
Beispiel #25
0
 public void OnTriggerEnter2D(Collider2D col)
 {
     if (!col.isTrigger && col.CompareTag("Enemy")){
         col.SendMessageUpwards("Damage", damage);
     }
 }
 public virtual void OnTriggerEnter2D(Collider2D other)
 {
     PreOnTriggerEnter2D (other);
     if (other.CompareTag("Player")) other.SendMessageUpwards ("ApplyDamage", 1, SendMessageOptions.DontRequireReceiver);
     PostOnTriggerEnter2D (other);
 }
Beispiel #27
0
	// Pisteet pelaajalle ja objekti tuhoutuu
	void OnTriggerEnter2D (Collider2D other){
		if (other.tag == "Player") {
			other.SendMessageUpwards ("getScore", scoreAmount, SendMessageOptions.DontRequireReceiver);
			Destroy(gameObject);
		}
	}
Beispiel #28
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player") {
         other.SendMessageUpwards("GameOver");
     }
 }
Beispiel #29
0
	// Use this for initialization

	void OnTriggerEnter2D (Collider2D col) {
		if (col.CompareTag("Stone")) {
			col.SendMessageUpwards ("BearHit");
		}
	}
 //Damages Collided enemy object
 public void DamageEnemy(Collider2D enemyCollider, int damage)
 {
     // ARKTODO: Think about the implications and performance of this call
     enemyCollider.SendMessageUpwards(CombatActions.TakeDamage, damage);
 }