コード例 #1
0
ファイル: TankMovement.cs プロジェクト: MeetChheda/Tanks
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Pick Up"))
        {
            other.gameObject.SetActive(false);
            TankHealth targetHealth = gameObject.GetComponent <TankHealth> ();

            targetHealth.AddHealth();
        }

        if (other.gameObject.CompareTag("Pick Down"))
        {
            other.gameObject.SetActive(false);
            TankHealth targetHealth = gameObject.GetComponent <TankHealth> ();

            targetHealth.SubHealth();
        }
    }