Пример #1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         vida.EatDamage();
     }
 }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     //碰到玩家,玩家死亡
     if (collision.gameObject.tag == "Player")
     {
         player.EatDamage();
         GameObject.Destroy(gameObject);
         return;
     }
 }
Пример #3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            Vida vida = collision.gameObject.GetComponent <Vida>();

            if (vida.invincivle || vida.inCharging)
            {
                //donothing
            }
            else if (vida.guardian)
            {
                vida.LoseGuard();
            }
            else
            {
                vida.EatDamage();
            }
        }

        GameObject.Destroy(gameObject);
    }
Пример #4
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        //如果还没击中,且碰到了玩家
        if (collision.gameObject.tag == "Player")
        {
            Vida vida = collision.gameObject.GetComponent <Vida>();

            if (vida.invincivle || vida.inCharging)
            {
                //donothing
            }
            else if (vida.guardian)
            {
                vida.LoseGuard();
            }
            else
            {
                vida.EatDamage();
            }
        }


        Die();
    }