コード例 #1
0
ファイル: Player.cs プロジェクト: kawzar/top-down-shooter
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.CompareTag(Constants.Tags.Weapon))
     {
         this.isNearWeapon = false;
         this.pickupWeapon = null;
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: kawzar/top-down-shooter
    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!");
            }
        }
    }