using UnityEngine;
using System.Collections;

public class ColourDish : MonoBehaviour {

	// Use this for initialization
	void Start () {
		
	}
	
	public GameObject[] colours;
	int previous = -1;
	
	void Update () {
		
		int current = -1;
		switch(References.GetFlashingColor()){
			case "turquoise":
				colours[0].animation.CrossFade("highlight");
				current = 0;
			break;
			case "cobalt":
				colours[1].animation.CrossFade("highlight");
				current = 1;
			break;
			case "violet":
				colours[2].animation.CrossFade("highlight");
				current = 2;
			break;
			case "crimson":
				colours[3].animation.CrossFade("highlight");
				current = 3;
			break;
			case "orange":
				colours[4].animation.CrossFade("highlight");
				current = 4;
			break;
			case "lime":
				colours[5].animation.CrossFade("highlight");
				current = 5;
			break;
			case "cyan":
				colours[6].animation.CrossFade("highlight");
				current = 6;
			break;
			case "magenta":
				colours[7].animation.CrossFade("highlight");
				current = 7;
			break;
			case "yellow":
				colours[8].animation.CrossFade("highlight");
				current = 8;
			break;
			case "red":
				colours[9].animation.CrossFade("highlight");
				current = 9;
			break;
			case "blue":
				colours[10].animation.CrossFade("highlight");
				current = 10;
			break;
			case "green":
				colours[11].animation.CrossFade("highlight");
				current = 11;
			break;
			case "white":
				/*
				colours[12].animation.CrossFade("highlight");
				current = 12;
				*/
			break;
			
			default:
				current = -1;
			break;
		}
		if(current != previous && previous >= 0){
			if(previous >= 9){
				colours[previous].transform.localScale = new Vector3(1.293497f,1.293497f,1.293497f);
			}else if(previous >= 6){
				colours[previous].transform.localScale = new Vector3(1.108284f,1.108284f,1.108284f);
			}else{
				colours[previous].transform.localScale = new Vector3(1f,1f,1f);
			}
			colours[previous].animation.Play("idle");
		}
		previous = current;
		
		
	}
}

