コード例 #1
0
ファイル: Item_HP.cs プロジェクト: pr0t0type94/Unity3D
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            healthScript = other.gameObject.GetComponent <Player_Health>();

            if (healthScript.CurrHp < healthScript.MaxHp)
            {
                source.Play();
                healthScript.HpPowerUpCollected();
                Destroy(gameObject);
            }
        }
    }