float GetCost<T>( ArrayGrid<T> map, Vector2 from, Vector2 to ) { if( !map.IsPositionEmpty( to ) ) { return float.MaxValue; } return ( to - from ).magnitude; }