public int GetDistanceToTargetSquare(MapSquare targetSquare) { int x = rowPosition; int y = parentRow.GetRowNumber(); int targetX = targetSquare.GetRowPosition(); int targetY = targetSquare.GetParentRow().GetRowNumber(); int distance = Mathf.Abs(x - targetX) + Mathf.Abs(y - targetY); return(distance); }