-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed any Goap* to ReGoap* to keep naming style.
Changed every ReGoap class to use generics so we are not bound anymore to <string, object> states, but anything can be used. Using Vector3? instead of Vector3 in the Unity example. Related to #13 This commit breaks every implementation.
- Loading branch information
Showing
53 changed files
with
544 additions
and
490 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
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public interface IReGoapAction | ||
public interface IReGoapAction<T, W> | ||
{ | ||
// this should return current's action calculated parameter, will be added to the run method | ||
// userful for dynamic actions, for example a GoTo action can save some informations (wanted position) | ||
// while being chosen from the planner, we save this information and give it back when we run the method | ||
IReGoapActionSettings GetSettings(IReGoapAgent goapAgent, ReGoapState goalState); | ||
void Run(IReGoapAction previousAction, IReGoapAction nextAction, IReGoapActionSettings settings, ReGoapState goalState, Action<IReGoapAction> done, Action<IReGoapAction> fail); | ||
void Exit(IReGoapAction nextAction); | ||
IReGoapActionSettings<T, W> GetSettings(IReGoapAgent<T, W> goapAgent, ReGoapState<T, W> goalState); | ||
void Run(IReGoapAction<T, W> previousAction, IReGoapAction<T, W> nextAction, IReGoapActionSettings<T, W> settings, ReGoapState<T, W> goalState, Action<IReGoapAction<T, W>> done, Action<IReGoapAction<T, W>> fail); | ||
void Exit(IReGoapAction<T, W> nextAction); | ||
Dictionary<string, object> GetGenericValues(); | ||
string GetName(); | ||
bool IsActive(); | ||
void PostPlanCalculations(IReGoapAgent goapAgent); | ||
void PostPlanCalculations(IReGoapAgent<T, W> goapAgent); | ||
bool IsInterruptable(); | ||
void AskForInterruption(); | ||
// THREAD SAFE | ||
ReGoapState GetPreconditions(ReGoapState goalState, IReGoapAction next = null); | ||
ReGoapState GetEffects(ReGoapState goalState, IReGoapAction next = null); | ||
bool CheckProceduralCondition(IReGoapAgent goapAgent, ReGoapState goalState, IReGoapAction nextAction = null); | ||
float GetCost(ReGoapState goalState, IReGoapAction next = null); | ||
ReGoapState<T, W> GetPreconditions(ReGoapState<T, W> goalState, IReGoapAction<T, W> next = null); | ||
ReGoapState<T, W> GetEffects(ReGoapState<T, W> goalState, IReGoapAction<T, W> next = null); | ||
bool CheckProceduralCondition(IReGoapAgent<T, W> goapAgent, ReGoapState<T, W> goalState, IReGoapAction<T, W> nextAction = null); | ||
float GetCost(ReGoapState<T, W> goalState, IReGoapAction<T, W> next = null); | ||
// DO NOT CHANGE RUNTIME ACTION VARIABLES, precalculation can be runned many times even while an action is running | ||
void Precalculations(IReGoapAgent goapAgent, ReGoapState goalState); | ||
void Precalculations(IReGoapAgent<T, W> goapAgent, ReGoapState<T, W> goalState); | ||
} | ||
|
||
public interface IReGoapActionSettings | ||
public interface IReGoapActionSettings<T, W> | ||
{ | ||
} |
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
using System.Collections.Generic; | ||
|
||
public interface IReGoapAgent | ||
public interface IReGoapAgent<T, W> | ||
{ | ||
IReGoapMemory GetMemory(); | ||
IReGoapGoal GetCurrentGoal(); | ||
void WarnPossibleGoal(IReGoapGoal goal); | ||
IReGoapMemory<T, W> GetMemory(); | ||
IReGoapGoal<T, W> GetCurrentGoal(); | ||
// called from a goal when the goal is available | ||
void WarnPossibleGoal(IReGoapGoal<T, W> goal); | ||
bool IsActive(); | ||
List<ReGoapActionState> GetStartingPlan(); | ||
T GetPlanValue<T>(string key); | ||
void SetPlanValue<T>(string key, T value); | ||
bool HasPlanValue(string target); | ||
List<ReGoapActionState<T, W>> GetStartingPlan(); | ||
W GetPlanValue(T key); | ||
void SetPlanValue(T key, W value); | ||
bool HasPlanValue(T target); | ||
// THREAD SAFE | ||
List<IReGoapGoal> GetGoalsSet(); | ||
List<IReGoapAction> GetActionsSet(); | ||
List<IReGoapGoal<T, W>> GetGoalsSet(); | ||
List<IReGoapAction<T, W>> GetActionsSet(); | ||
ReGoapState<T, W> InstantiateNewState(); | ||
} |
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 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
// interface needed only in Unity to use GetComponent and such features for generic agents | ||
public interface IReGoapAgentHelper | ||
{ | ||
Type[] GetGenericArguments(); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public interface IReGoapGoal | ||
public interface IReGoapGoal<T, W> | ||
{ | ||
void Run(Action<IReGoapGoal> callback); | ||
void Run(Action<IReGoapGoal<T, W>> callback); | ||
// THREAD SAFE METHODS (cannot use any unity library!) | ||
Queue<ReGoapActionState> GetPlan(); | ||
Queue<ReGoapActionState<T, W>> GetPlan(); | ||
string GetName(); | ||
void Precalculations(IGoapPlanner goapPlanner); | ||
void Precalculations(IGoapPlanner<T, W> goapPlanner); | ||
bool IsGoalPossible(); | ||
ReGoapState GetGoalState(); | ||
ReGoapState<T, W> GetGoalState(); | ||
float GetPriority(); | ||
void SetPlan(Queue<ReGoapActionState> path); | ||
void SetPlan(Queue<ReGoapActionState<T, W>> path); | ||
float GetErrorDelay(); | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
public interface IReGoapMemory | ||
public interface IReGoapMemory<T, W> | ||
{ | ||
ReGoapState GetWorldState(); | ||
ReGoapState<T, W> GetWorldState(); | ||
} |
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
Oops, something went wrong.