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


public class Zone
{
	private Rect m_Rectangle;
	public 	List<int> m_Neighbour;
	
	public Zone(float x, float y, float w, float h)
	{
		m_Rectangle.x = x;
		m_Rectangle.y = y;
		m_Rectangle.width = w;
		m_Rectangle.height = h;
	}
	
	public void AddNeighbour(int zoneId)
	{
		if (m_Neighbour == null) m_Neighbour = new List<int>();
		m_Neighbour.Add(zoneId);
	}
	
	public int GetNeighbour(int excludeZone)
	{
		//get a random neighbour that is not excludeId
		int zone = excludeZone;
		
		if (m_Neighbour == null) return zone;
		
		do
		{
			int rand = Random.Range(0, m_Neighbour.Count);
			zone = m_Neighbour[rand];
		}
		while (zone == excludeZone && m_Neighbour.Count > 1);

		return zone;
	}
	
	public Rect GetSize()
	{
		return m_Rectangle;	
	}
}

