Example #1
0
 private void CalculateConcatenatedColor(ref ColorBlock ioColorBlock)
 {
     m_Colors.Combine(ref ioColorBlock, out ioColorBlock);
     if (m_Parent)
     {
         m_Parent.CalculateConcatenatedColor(ref ioColorBlock);
     }
 }
Example #2
0
        private void UpdateColor(ref ColorBlock inParentColor)
        {
            if (m_IgnoreParentGroups)
            {
                m_ConcatenatedColorBlock = m_Colors;
            }
            else
            {
                inParentColor.Combine(ref m_Colors, out m_ConcatenatedColorBlock);
            }

            if (m_Renderer)
            {
                if (m_RendererAsSpriteRenderer)
                {
                    m_RendererAsSpriteRenderer.color = m_ConcatenatedColorBlock.Main;
                }

                if (m_MaterialConfig.ShouldAppply())
                {
                    MaterialPropertyBlock propBlock = GetSharedBlock();
                    m_Renderer.GetPropertyBlock(propBlock);
                    m_MaterialConfig.Apply(propBlock, ref m_ConcatenatedColorBlock);
                    m_Renderer.SetPropertyBlock(propBlock);
                }
            }

            if (m_Graphic)
            {
                m_Graphic.color = m_ConcatenatedColorBlock.Main;
            }

            if (m_Children != null)
            {
                for (int i = m_Children.Count - 1; i >= 0; --i)
                {
                    m_Children[i].UpdateColor(ref m_ConcatenatedColorBlock);
                }
            }
        }