Core/Maps: Implemented PolygonBoundary
Port From (https://github.com/TrinityCore/TrinityCore/commit/aed08b8a82cd4c14a6831ace7e9c4065ce29c5a4)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Game.Maps
|
namespace Game.Maps
|
||||||
{
|
{
|
||||||
@@ -218,6 +219,23 @@ namespace Game.Maps
|
|||||||
float _maxZ;
|
float _maxZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PolygonBoundary : AreaBoundary
|
||||||
|
{
|
||||||
|
Position _origin;
|
||||||
|
List<Position> _vertices;
|
||||||
|
|
||||||
|
public PolygonBoundary(Position origin, List<Position> vertices, bool isInverted = false) : base(isInverted)
|
||||||
|
{
|
||||||
|
_origin = origin;
|
||||||
|
_vertices = vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsWithinBoundaryArea(Position pos)
|
||||||
|
{
|
||||||
|
return pos.IsInPolygon2D(_origin, _vertices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class BoundaryUnionBoundary : AreaBoundary
|
class BoundaryUnionBoundary : AreaBoundary
|
||||||
{
|
{
|
||||||
public BoundaryUnionBoundary(AreaBoundary b1, AreaBoundary b2, bool isInverted = false) : base(isInverted)
|
public BoundaryUnionBoundary(AreaBoundary b1, AreaBoundary b2, bool isInverted = false) : base(isInverted)
|
||||||
|
|||||||
Reference in New Issue
Block a user