﻿//----------------------------------------------//
// Gamelogic Grids                              //
// http://www.gamelogic.co.za                   //
// Copyright (c) 2014 Gamelogic (Pty) Ltd       //
//----------------------------------------------//

using UnityEngine;

public class DFCell : GLMonoBehaviour
{
	public dfPanel panel;
	public dfSprite sprite;
	public dfLabel label;

	private Color onColor;
	private Color offColor;

	private bool on;

	public dfPanel Panel
	{
		get
		{
			return panel;
		}
	}

	public dfSprite Sprite
	{
		get
		{
			return sprite;
		}
	}

	public dfLabel Label
	{
		get
		{
			return label;
		}
	}

	public bool On
	{
		get
		{
			return on;
		}

		set
		{
			on = value;

			UpdateColors();
		}
	}

	private void UpdateColors()
	{
		sprite.Color = on ? onColor : offColor;
	}

	public void Awake()
	{
		On = false;
	}

	public void SetText(string text)
	{
		label.Text = text;
	}

	public void SetColors(Color onColor, Color offColor)
	{
		this.onColor = onColor;
		this.offColor = offColor;

		UpdateColors();
	}
}
