-
-
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
6 changed files
with
51 additions
and
17,043 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
17,043 changes: 11 additions & 17,032 deletions
17,043
Data/Examples/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
31 changes: 31 additions & 0 deletions
31
Source/Code/Duality.Plugins.Pathfindax/Components/DynamicPotentialFieldComponent.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,31 @@ | ||
using Duality.Editor; | ||
using Pathfindax.Grid; | ||
using Pathfindax.PathfindEngine; | ||
using Pathfindax.Paths; | ||
using Pathfindax.Utils; | ||
|
||
namespace Duality.Plugins.Pathfindax.Components | ||
{ | ||
[EditorHintCategory(PathfindaxStrings.Pathfindax)] | ||
[RequiredComponent(typeof(PotentialFieldPathfinderComponent))] | ||
public class DynamicPotentialFieldComponent : Component, ICmpInitializable | ||
{ | ||
public DynamicPotentialField PotentialField { get; private set; } | ||
public float UpdateInterval { get; set; } = 100f; | ||
void ICmpInitializable.OnInit(InitContext context) | ||
{ | ||
if (context == InitContext.Activate && DualityApp.ExecContext == DualityApp.ExecutionContext.Game) | ||
{ | ||
var pathfinder = GameObj.GetComponent<PotentialFieldPathfinderComponent>(); | ||
var definitionNodeNetwork = ((Pathfinder<DefinitionNodeGrid, DijkstraNodeGrid, PotentialField>) pathfinder.Pathfinder).DefinitionNodeNetwork; | ||
PotentialField = new DynamicPotentialField(definitionNodeNetwork.GridTransformer, UpdateInterval); | ||
} | ||
} | ||
|
||
void ICmpInitializable.OnShutdown(ShutdownContext context) | ||
{ | ||
PotentialField?.Dispose(); | ||
PotentialField = null; | ||
} | ||
} | ||
} |
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