Example #1
0
    // Update is called once per frame
    void Update()
    {
        health = healthBehaviour.GetCurrentHealth();

        if (health <= 50.0f && objToDeactivate.activeSelf)
        {
            objToDeactivate.SetActive(false);
        }
    }
Example #2
0
    void Update()
    {
        health =  healthBehaviour.GetCurrentHealth();

        if (health <= 70.0f)  // Change mesh to injured head
        {
            injuredHead.SetActive(true);

            fullBody.SetActive(false);
        }

        if (health <= 50.0f)  // Change mesh to half body
        {
            halfBody.SetActive(true);

            injuredHead.SetActive(false);
            leftEye.SetActive(false);
            rightEye.SetActive(false);
        }
    }