Beispiel #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Enemy enemy = other.gameObject.GetComponent <Enemy>();

        if (enemy != null)
        {
            Debug.Log($"Taking {enemy.baseAttack} damage");
            currentHealth.runtimeValue -= enemy.baseAttack;
            playerHealthSignal.RaiseSignal();
            if (currentHealth.runtimeValue <= 0)
            {
                this.gameObject.SetActive(false);
            }
        }
    }