Beispiel #1
0
    public Hex GetHoverHex(Vector2 point)
    {
        var q = (2.0f / 3.0f * point.x) / hexRadius;
        var r = (-1.0f / 3.0f * point.x + Mathf.Sqrt(3) / 3 * point.y) / hexRadius;

        try
        {
            Vector2 hexCoords = HexHelper.HexRound(point);
            return(hexTable.Where(h => h.Column == hexCoords.x && h.Row == hexCoords.y).FirstOrDefault());
        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
            return(new Hex());
        }
    }