-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
99 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 3 additions & 134 deletions
137
...ples/FlowFieldPathfinderExample.Scene.res → ...PotentialFieldPathfinderExample.Scene.res
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Source/Code/Duality.Plugins.Pathfindax/Components/Interfaces/IDualityPathfinderComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Duality.Plugins.Pathfindax.Components | ||
{ | ||
/// <summary> | ||
/// Interface for duality pathfinders | ||
/// </summary> | ||
public interface IDualityPathfinderComponent | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Source/Code/Duality.Plugins.Pathfindax/Components/PotentialFieldPathfinderComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Duality.Editor; | ||
using Pathfindax.Factories; | ||
using Pathfindax.Grid; | ||
using Pathfindax.Paths; | ||
using Pathfindax.Utils; | ||
|
||
namespace Duality.Plugins.Pathfindax.Components | ||
{ | ||
/// <summary> | ||
/// Provides a way for other components to request a path to B. Uses potential fields. | ||
/// </summary> | ||
[EditorHintCategory(PathfindaxStrings.Pathfindax)] | ||
[RequiredComponent(typeof(IDefinitionNodeNetworkProvider<DefinitionNodeGrid>))] | ||
public class PotentialFieldPathfinderComponent : PathfinderComponentBase<DefinitionNodeGrid> | ||
{ | ||
/// <summary> | ||
/// The max calculated clearance. Any clearance value higher than will be set to this. | ||
/// Try to keep this as low as possible to prevent wasting time calculating clearance values that will never be used. | ||
/// </summary> | ||
public int MaxClearance { get; set; } = 5; | ||
|
||
/// <summary> | ||
/// The maximum amount of cached <see cref="PotentialField"/>s | ||
/// </summary> | ||
public int MaxCachedFlowFields { get; set; } = 100; | ||
|
||
public override void OnInit(InitContext context) | ||
{ | ||
if (context == InitContext.Activate && DualityApp.ExecContext == DualityApp.ExecutionContext.Game) | ||
{ | ||
var definitionNodeGrid = GetSourceNodeNetwork(); | ||
if (definitionNodeGrid == null) return; | ||
Pathfinder = PathfinderFactory.CreatePotentialFieldPathfinder(PathfinderId, definitionNodeGrid, MaxClearance, MaxCachedFlowFields, AmountOfThreads); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters