Interface IFinder<TGraph, TResult>
Common Finder functionality. This can be used if you need interoperability between different finders and their results.
Inherited Members
Namespace: AnyPath.Managed
Assembly: Assembly-CSharp.dll
Syntax
public interface IFinder<TGraph, out TResult> : IFinder<TGraph>, IFinder
Type Parameters
Name | Description |
---|---|
TGraph | The type of graph this finder operates on |
TResult | The result of the last request |
Examples
public class IFinderExample
{
class BaseTarget
{
}
class DerivedTarget : BaseTarget
{
}
public void Test()
{
HexGridPathFinder pathFinderA = new HexGridPathFinder();
HexGridFirstTargetFinder<BaseTarget> pathFinderB = new HexGridFirstTargetFinder<BaseTarget>();
HexGridCheapestTargetFinder<DerivedTarget> pathFinderC = new HexGridCheapestTargetFinder<DerivedTarget>();
pathFinderA.Completed += OnCompletedWithoutTarget;
pathFinderB.Completed += OnCompletedWithoutTarget;
pathFinderC.Completed += OnCompletedWithoutTarget;
pathFinderB.Completed += OnCompletedWithTarget;
pathFinderC.Completed += OnCompletedWithTarget;
}
private void OnCompletedWithoutTarget(IFinder<HexGrid, Path<HexGridEdge>> obj)
{
// compatible with A, B and C
}
private void OnCompletedWithTarget(IFinder<HexGrid, IPath<BaseTarget, HexGridEdge>> obj)
{
// using IPath with BaseTarget as the resut type makes this handler accept paths coming from both B and C
}
}
Properties
| Improve this Doc View SourceResult
The result of the last request on this finder.
Declaration
TResult Result { get; }
Property Value
Type | Description |
---|---|
TResult |