Esempio n. 1
0
    void Awake()
    {
        _playerController = GetComponent <PlayerController>();
        _gunController    = GetComponent <GunController>();

        HealthDisplaySystem.DisplayHP(true);
    }
Esempio n. 2
0
    void Awake()
    {
        HealthDisplaySystem.DisplayHP(true);
        HealthDisplaySystem.SetMaxHP(maxHealth, true);
        _health = maxHealth;

        transform.Find("Dead").gameObject.SetActive(false);
    }
Esempio n. 3
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(this);
            return;
        }

        instance = this;

        MaxHP     = 6;
        CurrentHP = MaxHP;

        UpdateRender();

        DisplayHP(false);
    }
Esempio n. 4
0
    public void AdjustHealth(int value, Vector3 direction = default)
    {
        if (Dead)
        {
            return;
        }

        _health = Mathf.Clamp(_health + value, 0, maxHealth);
        HealthDisplaySystem.SetCurrentHP(_health);
        FindObjectOfType <CameraController>().ApplyCameraShake();

        if (_health == 0)
        {
            Dead = true;
            StartCoroutine(OnDead(direction));
        }
    }