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

public class BuildWandRandomizer : MonoBehaviour {

	float h;
	Color startColor, randomColor;
	Material buildWandMat;
	[VariableToggle("displayImage", false)]
	public Image display;
	[ReadOnly]
	public bool displayImage;
	public static bool isActive = false;

	void Start () {
		isActive = false;
		buildWandMat = GetComponent<MeshRenderer> ().material;
		h = 0f;
	}

	void Update () {
		if ((isActive && gameObject.tag != "Builder Wand") || (GetComponent<MeshRenderer> ().enabled && gameObject.tag == "Builder Wand")) {
			buildWandMat.SetColor ("_EmissionColor", Color.HSVToRGB (h, 1, 1, true));
			if(display)
				display.color = Color.HSVToRGB (h, 1, 1, true);

			if (h >= 1f) {
				h = 0f;
			} else {
				h = h + 0.0025f;
			}
		}
	}

}
