Example #1
0
 // Update is called once per frame
 void Update()
 {
     usernameText.text        = m_Player.GetUsername();
     usernameText.color       = m_Player.m_Color;
     healthBarFill.localScale = new Vector3(1, m_Player.GetHealthAmount() / m_Player.maxHealth, 1);
     healthBarFill.GetComponent <Image>().color = m_Player.m_Color;
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (healthBarFill.GetComponent <Image>().color != m_Player.m_Color)
        {
            healthBarFill.GetComponent <Image>().color = m_Player.m_Color;
        }

        SetHealthAmount(m_Player.maxHealth, m_Player.GetHealthAmount());

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            TogglePause();
        }

        if (_killTarget.color != Color.clear)
        {
            _killTarget.color = Color.Lerp(_killTarget.color, Color.clear, 3 * Time.deltaTime);
        }

        if (_hitTarget.color != Color.clear)
        {
            _hitTarget.color = Color.Lerp(_hitTarget.color, Color.clear, 2 * Time.deltaTime);
        }

        if (_panel.color != Color.clear)
        {
            _panel.color = Color.Lerp(_panel.color, Color.clear, 2 * Time.deltaTime);
        }

        if (showAim)
        {
            _crosshair.color = Color.Lerp(_crosshair.color, Color.white, 6 * Time.deltaTime);
        }
        else if (_crosshair.color != Color.clear)
        {
            _crosshair.color = Color.Lerp(_crosshair.color, Color.clear, 6 * Time.deltaTime);
        }
    }