diff options
author | syeyoung <cyong06@naver.com> | 2021-02-10 16:52:36 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-10 16:52:36 +0900 |
commit | 2223e55d5d9c61f4ab93d8dab0b5f9820272c8fe (patch) | |
tree | cb974956664f7402358e1549d3cff35af8a45145 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions | |
parent | 26de881921c351c9b39dfef5e3770e7d042ddd53 (diff) | |
download | Skyblock-Dungeons-Guide-2223e55d5d9c61f4ab93d8dab0b5f9820272c8fe.tar.gz Skyblock-Dungeons-Guide-2223e55d5d9c61f4ab93d8dab0b5f9820272c8fe.tar.bz2 Skyblock-Dungeons-Guide-2223e55d5d9c61f4ab93d8dab0b5f9820272c8fe.zip |
add get all states
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java new file mode 100644 index 00000000..b60b8fb0 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java @@ -0,0 +1,34 @@ +package kr.syeyoung.dungeonsguide.dungeon.actions.tree; + +import kr.syeyoung.dungeonsguide.dungeon.actions.Action; +import lombok.Getter; + +import java.util.List; + +public class ActionRoute { + @Getter + private int current; + @Getter + private List<Action> actions; + + public ActionRoute(ActionTree tree) { + actions = ActionTreeUtil.linearifyActionTree(tree); + current = 0; + } + + public Action next() { + current ++; + if (current >= actions.size()) current = actions.size() - 1; + return actions.get(current); + } + + public Action prev() { + current --; + if (current < 0) current = 0; + return actions.get(current); + } + + public Action getCurrentAction() { + return actions.get(current); + } +} |