using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ToyotaColorVariantController : MonoBehaviour
{
    public List<GameObject> meshes;
    public List<GameObject> platos_meshes;
    public List<Color> colors_auto;
    public List<Color> colors_platos;
    private int current_id;
    private int current_id_platos;

    public void SwitchearColor()
    {
        this.SetColor(current_id);
        current_id++;
        if (current_id >= colors_auto.Count)
        {
            current_id = 0;
        }
    }

    public void SwitchearColor_platos()
    {
        this.SetColor_platos(current_id_platos);
        current_id_platos++;
        if (current_id_platos >= colors_platos.Count)
        {
            current_id_platos = 0;
        }
    }

    public void SetColor(int id)
    {
        foreach (GameObject item in meshes)
        {
            item.GetComponent<MeshRenderer>().material.color = this.colors_auto[id];
        }
    }

    public void SetColor_platos(int id)
    {
        foreach (GameObject item in platos_meshes)
        {
            item.GetComponent<MeshRenderer>().material.color = this.colors_platos[id];
        }
    }
}
