Exemplo n.º 1
0
        public void Update()
        {
            var value = (Time.time - _currentColorCycleStart) / _durations[_index];
            var next  = (_index + 1) % _colors.Length;

            SpriteRendererExtensions.LerpColor(_renderers, _colors[_index], _colors[next], Mathf.Min(1.0f, value));

            if (value >= 1.0f)
            {
                _index = next;
                _currentColorCycleStart = Time.time;
            }
        }
Exemplo n.º 2
0
 public virtual void Start()
 {
     SpriteRendererExtensions.CollectSpriteRenderers(gameObject, _renderers);
     _index = 0;
     _currentColorCycleStart = Time.time;
 }