Example #1
0
    public void SetPlayer(IHealthView ihealthView)
    {
        entityHealth = ihealthView;
        entityHealth.SetMaxHealth(entityInfo.MaxHealth);
        entityHealth.SetHealthQ(HealthQ);
        if (entityInfo.Color != null)
        {
            var m_PlayerColor = new UnityEngine.Color();
            m_PlayerColor.r = (float)entityInfo.Color.R;
            m_PlayerColor.b = (float)entityInfo.Color.B;
            m_PlayerColor.g = (float)entityInfo.Color.G;
            Debug.Log("Color" + entityInfo.Color);
            m_ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(m_PlayerColor) + ">PLAYER " + m_PlayerNumber + "</color>";
            MeshRenderer[] renderers = m_Instance.GetComponentsInChildren <MeshRenderer>();

            for (int i = 0; i < renderers.Length; i++)
            {
                renderers[i].material.color = m_PlayerColor;
            }
        }
    }
Example #2
0
 private void Start()
 {
     _healthView = GetComponent <IHealthView>();
     _healthView.RenderHealth(_health.Amount);
     _health.OnChange += healthAmount => { _healthView.RenderHealth(healthAmount); };
 }