using UnityEngine;
using System.Collections.Generic;

public class TracerColor : MonoBehaviour {

    public Color playerColor = new Color(1, 1, 0);

    public List<Material> diffuseUserColor = new List<Material>();
    public List<Material> emissionUserColor = new List<Material>();

    public void Start() {
        OnColorChanged();
    }

    public void OnColorChanged() {
        foreach (Material diffuseMaterial in diffuseUserColor) {
            diffuseMaterial.SetColor("_Color", playerColor);
        }
        foreach (Material emissionMaterial in emissionUserColor) {
            if (emissionMaterial.HasProperty("_EmissionColor")) {
                emissionMaterial.SetColor("_EmissionColor", playerColor);
            }
        }
    }

}
