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

//TODO: Should be called Cell or Space I guess
public class Seat : MonoBehaviour {
	public Renderer[] colorBodies;
	public Renderer floor;
	public GameObject[] seatBodies;

	public Entity entityPrefab;

	public TextMesh lblNumber;

	public Entity entity;	//For convenience
	public int x, z;		//For convenience
	public PlaneGrid grid;

	public int karma;

	Color _colorSeat;
	public bool usable = true;
	public Vector2 steer;	
	public Color colorFloor {
		get { return floor.material.color; }
		set { 
			floor.material.color = value;
		}
	}

	public Color colorSeat {
		get { return _colorSeat; }
		set {
			_colorSeat = value;
			foreach(var b in colorBodies) {
				b.material.color = value;
			}
		}
	}
	bool _hallway = false;
	public bool hallway {
		get { return _hallway; }
		set {
			if(_hallway != value) {
				_hallway = value;
				foreach(var b in seatBodies) {
					b.SetActive(!value);
				}
			}
		}		
	}

	// Use this for initialization
	void Start () {
		_colorSeat = Color.blue;
		if(entityPrefab != null) {
			entity = Instantiate(entityPrefab);
			entity.seat = this;
		}
	}

	// Update is called once per frame
	void Update () {
		
	}
}
