using System.Collections.Generic;
using UnityEngine;

public class Tile : TileAsset
{
	public bool canEnter = true;
	public List<TileAsset> occupiedBy;

	public override bool CanEnter(Vector2Int comingFrom, Vector2Int goingInto, Orientation orientation)
	{
		foreach (var tileAsset in occupiedBy)
		{
			if (!tileAsset.CanEnter(comingFrom, goingInto, orientation))
			{
				return false;
			}
		}

		return canEnter;
	}

	public override void OnEnter(GameObject player)
	{
		foreach (var tileAsset in occupiedBy)
		{
			tileAsset.OnEnter(player);
		}
	}

	public override void OnLeave(GameObject player)
	{
		foreach (var tileAsset in occupiedBy)
		{
			tileAsset.OnLeave(player);
		}
	}
}
