using UnityEngine;
public class HexCell : MonoBehaviour {
public HexCoordinates coordinates;
public Color color;
[SerializeField]
HexCell[] neighbors;
public static HexDirection Opposite (this HexDirection direction)
{
return (int)direction < 3 ? (direction + 3) : (direction - 3);
}
public HexCell GetNeighbor (HexDirection direction)
{
return neighbors[(int)direction];
}
public void SetNeighbor(HexDirection direction, HexCell cell)
{
neighbors[(int)direction] = cell;
cell.neighbors[(int)direction.Opposite()] = this;
}
}
So I was following a CatLikeCoding tutorial, and when I finished with the second part of the tutorial, I go to Unity and I see an error in the console.
(3, 14): error CS1106: Extension method must be defined in a non-generic class.