Show / Hide Table of Contents

    Class AStarPathFinder

    Class that represents a path finder that implements the A* algorithm to find a path bewteen two Locations.

    Inheritance
    System.Object
    AStarPathFinder
    Implements
    IPathFinder
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Fibula.PathFinding.AStar
    Assembly: Fibula.Mechanics.PathFinding.AStar.dll
    Syntax
    public class AStarPathFinder : IPathFinder

    Constructors

    | Improve this Doc View Source

    AStarPathFinder(INodeFactory, IMap, IOptions<AStarPathFinderOptions>)

    Initializes a new instance of the AStarPathFinder class.

    Declaration
    public AStarPathFinder(INodeFactory nodeFactory, IMap map, IOptions<AStarPathFinderOptions> pathfinderOptions)
    Parameters
    Type Name Description
    INodeFactory nodeFactory

    A reference to the node factory in use.

    IMap map

    A refernce to the map isntance.

    Microsoft.Extensions.Options.IOptions<AStarPathFinderOptions> pathfinderOptions

    The options for this pathfinder.

    Properties

    | Improve this Doc View Source

    Map

    Gets the tile accessor in use.

    Declaration
    public IMap Map { get; }
    Property Value
    Type Description
    IMap
    | Improve this Doc View Source

    NodeFactory

    Gets a reference to the node factory in use.

    Declaration
    public INodeFactory NodeFactory { get; }
    Property Value
    Type Description
    INodeFactory
    | Improve this Doc View Source

    Options

    Gets the options to use for this path finder.

    Declaration
    public AStarPathFinderOptions Options { get; }
    Property Value
    Type Description
    AStarPathFinderOptions

    Methods

    | Improve this Doc View Source

    FindBetween(Location, Location, ICreature, Int32, Boolean, Int32, Location[])

    Attempts to find a path using the AStar implementation between two Locations.

    Declaration
    public (SearchState result, Location endLocation, IEnumerable<Direction> directions) FindBetween(Location startLocation, Location targetLocation, ICreature onBehalfOfCreature = null, int maxStepsCount = 0, bool considerAvoidsAsBlocking = true, int targetDistance = 1, params Location[] excludeLocations)
    Parameters
    Type Name Description
    Location startLocation

    The start location.

    Location targetLocation

    The target location to find a path to.

    ICreature onBehalfOfCreature

    Optional. The creature on behalf of which the search is being performed.

    System.Int32 maxStepsCount

    Optional. The maximum number of search steps to perform before giving up on finding the target location. Default is DefaultMaximumSteps.

    System.Boolean considerAvoidsAsBlocking

    Optional. A value indicating whether to consider the creature avoid tastes as blocking in path finding. Defaults to true.

    System.Int32 targetDistance

    Optional. The target distance from the target node to shoot for.

    Location[] excludeLocations

    Optional. Locations to explicitly exclude as a valid goal in the search.

    Returns
    Type Description
    System.ValueTuple<SearchState, Location, System.Collections.Generic.IEnumerable<Direction>>

    A tuple consisting of the result of the path search, the end location before returning (even when giving up), and an System.Collections.Generic.IEnumerable<T> of Directions leading to that end location.

    Implements

    IPathFinder

    Extension Methods

    ObjectExtensions.YieldSingleItem<T>(T)
    ObjectExtensions.GetPropertyValue(Object, String)
    Validate.ThrowIfNull(Object, String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.