예제 #1
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.CompareTag(Constants.Tags.Weapon))
     {
         this.isNearWeapon = false;
         this.pickupWeapon = null;
     }
 }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag(Constants.Tags.Weapon))
        {
            this.isNearWeapon = true;
            this.pickupWeapon = collision.gameObject.GetComponent <FloorWeapon>();
        }

        if (collision.CompareTag(Constants.Tags.Projectile))
        {
            this.hp -= BulletManager.Instance.BulletDamage(collision);

            if (hp <= 0)
            {
                Debug.Log("Player died!");
            }
        }
    }