void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player_Bird")
     {
         healthBarSwapper.HurtPlayer(damageToGive);
     }
 }
Example #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player_Bird")
     {
         Debug.Log("dafuq");
         healthBarSwapper.HurtPlayer(damageToGive);
         Destroy(gameObject);
     }
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log ("trigger enter");
        if (other.name == "Player_Bird" && healthBarSwapper.playerHealth > 0)
        {
            healthBarSwapper.HurtPlayer(damageToGive);
//			other.GetComponent<AudioSource>().Play();
            var player = other.GetComponent <Player_Script>();
            player.knockBackCount = player.knockBackLength;
            if (other.transform.position.x < transform.position.x)
            {
                player.knockPlayer(false);
            }
            else
            {
                player.knockPlayer(true);
            }
        }
    }