C# Класс Pathfinding.MultiTargetPath

Наследование: ABPath
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
callbacks OnPathDelegate[]
chosenTarget int
heuristicMode HeuristicMode
nodePaths List[]
originalTargetPoints Vector3[]
pathsForAll bool
targetNodes GraphNode[]
targetPoints Vector3[]
targetsFound bool[]
vectorPaths List[]

Защищенные свойства (Protected)

Свойство Тип Описание
targetNodeCount int

Открытые методы

Метод Описание
ChooseShortestPath ( ) : void

Set chosenTarget to the index of the shortest path

Construct ( Array startPoints, Vector3 target, Array callbackDelegates, OnPathDelegate callback = null ) : MultiTargetPath
Construct ( Vector3 start, Array targets, Array callbackDelegates, OnPathDelegate callback = null ) : MultiTargetPath
MultiTargetPath ( ) : UnityEngine

Default constructor. Do not use this. Instead use the static Construct method which can handle path pooling.

RecalculateHTarget ( bool firstTime ) : void
ResetFlags ( ) : void

Reset flag1 on all nodes after the pathfinding has completed (no matter if an error occurs or if the path is canceled)

SetPathParametersForReturn ( int target ) : void

Защищенные методы

Метод Описание
CalculateStep ( long targetTick ) : void
Cleanup ( ) : void
FoundTarget ( PathNode nodeR, int i ) : void
Initialize ( ) : void
OnEnterPool ( ) : void
Prepare ( ) : void
RebuildOpenList ( ) : void
Reset ( ) : void
ReturnPath ( ) : void
Setup ( Vector3 start, Array targets, Array callbackDelegates, OnPathDelegate callback ) : void
Trace ( PathNode node ) : void

Приватные методы

Метод Описание
DebugString ( PathLog logMode ) : string

Описание методов

CalculateStep() защищенный Метод

protected CalculateStep ( long targetTick ) : void
targetTick long
Результат void

ChooseShortestPath() публичный Метод

Set chosenTarget to the index of the shortest path
public ChooseShortestPath ( ) : void
Результат void

Cleanup() защищенный Метод

protected Cleanup ( ) : void
Результат void

Construct() публичный статический Метод

public static Construct ( Array startPoints, Vector3 target, Array callbackDelegates, OnPathDelegate callback = null ) : MultiTargetPath
startPoints Array
target Vector3
callbackDelegates Array
callback OnPathDelegate
Результат MultiTargetPath

Construct() публичный статический Метод

public static Construct ( Vector3 start, Array targets, Array callbackDelegates, OnPathDelegate callback = null ) : MultiTargetPath
start Vector3
targets Array
callbackDelegates Array
callback OnPathDelegate
Результат MultiTargetPath

FoundTarget() защищенный Метод

protected FoundTarget ( PathNode nodeR, int i ) : void
nodeR PathNode
i int
Результат void

Initialize() защищенный Метод

protected Initialize ( ) : void
Результат void

MultiTargetPath() публичный Метод

Default constructor. Do not use this. Instead use the static Construct method which can handle path pooling.
public MultiTargetPath ( ) : UnityEngine
Результат UnityEngine

OnEnterPool() защищенный Метод

protected OnEnterPool ( ) : void
Результат void

Prepare() защищенный Метод

protected Prepare ( ) : void
Результат void

RebuildOpenList() защищенный Метод

protected RebuildOpenList ( ) : void
Результат void

RecalculateHTarget() публичный Метод

public RecalculateHTarget ( bool firstTime ) : void
firstTime bool
Результат void

Reset() защищенный Метод

protected Reset ( ) : void
Результат void

ResetFlags() публичный Метод

Reset flag1 on all nodes after the pathfinding has completed (no matter if an error occurs or if the path is canceled)
public ResetFlags ( ) : void
Результат void

ReturnPath() защищенный Метод

protected ReturnPath ( ) : void
Результат void

SetPathParametersForReturn() публичный Метод

public SetPathParametersForReturn ( int target ) : void
target int
Результат void

Setup() защищенный Метод

protected Setup ( Vector3 start, Array targets, Array callbackDelegates, OnPathDelegate callback ) : void
start Vector3
targets Array
callbackDelegates Array
callback OnPathDelegate
Результат void

Trace() защищенный Метод

protected Trace ( PathNode node ) : void
node PathNode
Результат void

Описание свойств

callbacks публичное свойство

Callbacks to call for each individual path
public OnPathDelegate[] callbacks
Результат OnPathDelegate[]

chosenTarget публичное свойство

The closest target index (if any target was found)
public int chosenTarget
Результат int

heuristicMode публичное свойство

How to calculate the heuristic. The \link hTarget heuristic target point \endlink can be calculated in different ways, by taking the Average position of all targets, or taking the mid point of them (i.e center of the AABB encapsulating all targets). The one which works best seems to be Sequential, it sets hTarget to the target furthest away, and when that target is found, it moves on to the next one.\n Some modes have the option to be 'moving' (e.g 'MovingAverage'), that means that it is updated every time a target is found.\n The H score is calculated according to AstarPath.heuristic Note: If pathsForAll is false then this option is ignored and it is always treated as being set to None
public HeuristicMode heuristicMode
Результат HeuristicMode

nodePaths публичное свойство

Stores all paths to the targets. Elements are null if no path was found
public List[] nodePaths
Результат List[]

originalTargetPoints публичное свойство

Target points specified when creating the path. These are not snapped to the nearest nodes
public Vector3[] originalTargetPoints
Результат Vector3[]

pathsForAll публичное свойство

If true, a path to all targets will be returned, otherwise just the one to the closest one.
public bool pathsForAll
Результат bool

targetNodeCount защищенное свойство

Number of target nodes left to find
protected int targetNodeCount
Результат int

targetNodes публичное свойство

Nearest nodes to the targetPoints
public GraphNode[] targetNodes
Результат GraphNode[]

targetPoints публичное свойство

Target points specified when creating the path. These are snapped to the nearest nodes
public Vector3[] targetPoints
Результат Vector3[]

targetsFound публичное свойство

Indicates if the target has been found. Also true if the target cannot be reached (is in another area)
public bool[] targetsFound
Результат bool[]

vectorPaths публичное свойство

Stores all vector paths to the targets. Elements are null if no path was found
public List[] vectorPaths
Результат List[]