public abstract class ComplexHighSkill extends HighSkill implements IComplexHighSkill
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ComplexHighSkill.ComplexHighSkillState |
HighSkill.HighSkillState
Modifier and Type | Field and Description |
---|---|
private HighSkill |
hs |
private LowSkill |
ls |
ComplexHighSkill.ComplexHighSkillState |
state |
currentSkill, name, nextSkill
Constructor and Description |
---|
ComplexHighSkill() |
Modifier and Type | Method and Description |
---|---|
void |
checkProgress()
Called on every single step of the high skill.
|
private LowSkill |
getLowSkillFromNewHighSkill() |
abstract HighSkill |
pickHighSkill() |
LowSkill |
pickLowSkill()
Called everytime the current low skill enters a phase that be can be finalized
(so that it's possible to safely switch to a new low skill, see TODO: wiki link)
|
execute, getCurrentSkill, isEnded, setCurrentSkill, toString
public ComplexHighSkill.ComplexHighSkillState state
private HighSkill hs
private LowSkill ls
public LowSkill pickLowSkill()
HighSkill
Called everytime the current low skill enters a phase that be can be finalized (so that it's possible to safely switch to a new low skill, see TODO: wiki link)
Returns the next skill that needs to be executed in order to fulfill goals of this HighSkill.
If the returned skill is the same as the current skill, it will continue normally.
If a different low skill or null is returned, the current low skill will be finalized. Once that finalization has been succesfully completed, the returned low skill will be set as the new executed low skill, or, if null was returned, the high skill will end.
pickLowSkill
in interface IHighSkill
pickLowSkill
in class HighSkill
private LowSkill getLowSkillFromNewHighSkill()
public abstract HighSkill pickHighSkill()
pickHighSkill
in interface IComplexHighSkill
public void checkProgress() throws Exception
HighSkill
Called on every single step of the high skill. That means every tick.
Should throw an exception if the agent is found to be in an unexpected state, e.g. fallen on ground during walking.
Causes this skill's execution to be immediately terminated.
TODO: does it work? should it work this way? currently, falling is handled by the pickLowSkill methods in our high skillscheckProgress
in interface IHighSkill
checkProgress
in class HighSkill
Exception
- means that the high skill needs to be interrupted without regard
to safe finalization of the current low skill