Хорошо, понял это после некоторого глубокого поиска в Google, проб и ошибок. Все, что мне было нужно, это наследующий класс, который переопределяет метод RuleMatch. Надеюсь, это будет полезно другим.
using System;
using UnityEngine;
using UnityEngine.Tilemaps;
[Serializable]
[CreateAssetMenu(fileName = "CoastHexagonTile", menuName = "Tiles/CoastHexagonTile")]
public class CoastHexagonTile : HexagonalRuleTile<CoastHexagonTile.Neighbor>
{
public bool isOcean;
public bool isCoast;
public class Neighbor : TilingRule.Neighbor
{
public const int IsOcean = 3;
public const int IsNotOcean = 4;
public const int IsCoast = 5;
public const int IsNotCoast = 6;
}
/// <summary>
/// Checks if there is a match given the neighbor matching rule and a Tile.
/// </summary>
/// <param name="neighbor">Neighbor matching rule.</param>
/// <param name="other">Tile to match.</param>
/// <returns>True if there is a match, False if not.</returns>
public override bool RuleMatch(int neighbor, TileBase tile)
{
var other = tile as CoastHexagonTile;
switch (neighbor)
{
case Neighbor.IsOcean:
return other && other.isOcean;
case Neighbor.IsNotOcean:
return other && !other.isOcean;
case Neighbor.IsCoast:
return other && other.isCoast;
case Neighbor.IsNotCoast:
return other && !other.isCoast;
}
return base.RuleMatch(neighbor, tile);
}
}
Редактировать: К сожалению, похоже, что не все тайлы правил почему-то подчиняются правилам. Я устанавливаю каждую плитку программно на большой карте. Интересно, в этом ли причина? быть позванным. Я думаю, что это верно только тогда, когда плитки перемещаются и устанавливаются программно во время выполнения, как я.