Beispiel #1
0
    internal void TakeDamage()
    {
        if (isShieldsActive)
        {
            _lives++;
            isShieldsActive = false;
            _shieldsVisualizer.SetActive(false);
            return;
        }

        _lives--;

        if (_lives == 2)
        {
            _leftWing.SetActive(true);
        }
        else if (_lives == 1)
        {
            _rigthWing.SetActive(true);
        }

        uI_Manager?.UpdateLives(_lives);

        if (_lives < 1)
        {
            Instantiate(_explosonPrefab, transform.position, Quaternion.identity);
            Destroy(this.gameObject);
            // I need to tell the Spawn_Manager, to stop
            spawn_Manager.isPlayerDead(true);
        }
    }