using System.Collections.Generic;
using UnityEngine;
using mgaia.Utils;
using mgaia.Utils.LayerSystem;

namespace mgaia.tk2d.TouchEffects
{
    /// <summary>
    /// Classe para efeitos de cor utilizando a tk2d
    /// </summary>
    /// <owner>Victor</owner>
    public abstract class tk2dAbstractColorEffect : AbstractColorEffect
    {
        /// <summary>
        /// Retorna os containers de sprite
        /// </summary>
        protected override IColorContainer[] GetSpriteContainers()
        {
            List<IColorContainer> colorContainers = new List<IColorContainer>();

            foreach (tk2dBaseSprite baseSprite in GetComponentsInChildren<tk2dBaseSprite>())
            {
                colorContainers.Add(new SpriteColorContainer(baseSprite));
            }

            return colorContainers.ToArray();
        }

        /// <summary>
        /// Retorna os containers de texto
        /// </summary>
        protected override IColorContainer[] GetTextContainers()
        {
            List<IColorContainer> colorContainers = new List<IColorContainer>();

            foreach (tk2dTextMesh textMesh in GetComponentsInChildren<tk2dTextMesh>())
            {
                colorContainers.Add(new TextMeshColorContainer(textMesh));
            }

            return colorContainers.ToArray();
        }
    }
}