using UnityEngine;

public static class ExtensionMethods
{
    public static GameObject TryGetElement(this GameObject[,] array, int x, int y)
    {
        if (x >= 0 && x < array.GetLength(0) && y >= 0 && y < array.GetLength(1))
        {
            return array[x, y];
        }
        return null;
    }
}
