reckfellENGINE

PolygonPathFinder

Тип C# SDK Reckfell.

На этой странице
class PolygonPathFinderReckfellSharpНаследует Resource

Объявления сверены с C# SDK 1.0.0. Раскройте имя, чтобы увидеть сигнатуры и описание.

Конструкторы1

PolygonPathFinderКонструктор
# PolygonPathFinder
C#
public PolygonPathFinder();

Свойства1

DataСвойство
# Data
C#
public Reckfell.Collections.Dictionary Data { get; set; }

Методы9

FindPathVector2[]
# FindPath
C#
public Vector2[] FindPath(Vector2 from, Vector2 to);
Параметры
ИмяТипПо умолчанию
fromVector2—
toVector2—
Возвращает Vector2[]
GetBoundsRect2
# GetBounds
C#
public Rect2 GetBounds();
Возвращает Rect2
GetClosestPointVector2
# GetClosestPoint
C#
public Vector2 GetClosestPoint(Vector2 point);
Параметры
ИмяТипПо умолчанию
pointVector2—
Возвращает Vector2
GetIntersectionsVector2[]
# GetIntersections
C#
public Vector2[] GetIntersections(Vector2 from, Vector2 to);
Параметры
ИмяТипПо умолчанию
fromVector2—
toVector2—
Возвращает Vector2[]
GetPointPenaltyfloat
# GetPointPenalty
C#
public float GetPointPenalty(int idx);
Параметры
ИмяТипПо умолчанию
idxint—
Возвращает float
IsPointInsidebool
# IsPointInside
C#
public bool IsPointInside(Vector2 point);

Возвращает true, если point попадает внутрь области многоугольника.

C#
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
    new Vector2(0.0f, 0.0f),
    new Vector2(1.0f, 0.0f),
    new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);
ReckfellApi.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints True
ReckfellApi.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints False
Параметры
ИмяТипПо умолчанию
pointVector2—
Возвращает bool
SetPointPenaltyvoid
# SetPointPenalty
C#
public void SetPointPenalty(int idx, float penalty);
Параметры
ИмяТипПо умолчанию
idxint—
penaltyfloat—
Setup2 перегрузки
# Setup · 1/2
C#
public void Setup(Vector2[] points, int[] connections);

Устанавливает PolygonPathFinder с массивом точек, которые определяют вершины многоугольника, и массивом индексов, которые определяют ребра многоугольника. Длина connections должна быть четной, возвращает ошибку, если нечетная.

C#
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
    new Vector2(0.0f, 0.0f),
    new Vector2(1.0f, 0.0f),
    new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);
Параметры
ИмяТипПо умолчанию
pointsVector2[]—
connectionsint[]—
# Setup · 2/2
C#
public void Setup(ReadOnlySpan<Vector2> points, ReadOnlySpan<int> connections);

Устанавливает PolygonPathFinder с массивом точек, которые определяют вершины многоугольника, и массивом индексов, которые определяют ребра многоугольника. Длина connections должна быть четной, возвращает ошибку, если нечетная.

C#
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
    new Vector2(0.0f, 0.0f),
    new Vector2(1.0f, 0.0f),
    new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);
Параметры
ИмяТипПо умолчанию
pointsReadOnlySpan<Vector2>—
connectionsReadOnlySpan<int>—
Документация Reckfell EngineНаверх ↑
БЫСТРЫЙ ПЕРЕХОДНачало работыEntity и иерархияC# & .NET 10Сцены и префабы
Руководства и полный API Reckfell K
reckfellENGINE
RECKFELL ACCOUNT

Вход в аккаунт

Войдите в аккаунт Reckfell.

Один аккаунт для всей платформы Reckfell.