Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (script.getCurrHealth() == script.getMaxHealth())
        {
            this.GetComponent <CanvasGroup>().alpha = 0;
            return;
        }
        this.GetComponent <CanvasGroup>().alpha = 1;
        Vector3 targetPostition = new Vector3(player.position.x,
                                              this.transform.position.y,
                                              player.position.z);

        transform.LookAt(targetPostition);
        healthBar.fillAmount = (script.getCurrHealth() / script.getMaxHealth());
    }