Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is purpose of hasActionPlan test twice in GoapAgent. #1

Open
madan-ram opened this issue Feb 19, 2017 · 1 comment
Open

what is purpose of hasActionPlan test twice in GoapAgent. #1

madan-ram opened this issue Feb 19, 2017 · 1 comment

Comments

@madan-ram
Copy link

I see in line 135 of GoapAgent.cs as shown below code, but there is else condition at 170 which solves a similar problem. can you explain in which condition this is needed?
if (!hasActionPlan()) { // no actions to perform Debug.Log("<color=red>Done actions</color>"); fsm.popState(); fsm.pushState(idleState); dataProvider.actionsFinished(); return; }

@XenoDaimon
Copy link

In that case it doesn't seems to make much a difference.

However, if you land in the first if (!hasActionPlan()) it means you're in the performActionState while not having any plan.
If you land in the else condition, line 170 in the code, it means you have successfully achieved every action in your plan (since you had a plan when entering the state but the last action has been removed line 146).

Hope this is correct and it helps you @madan-ram

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants