summaryrefslogtreecommitdiff
path: root/src/reducers/interaction-level.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-08-26 13:53:21 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:45 +0200
commitbbb802b4142d11f020994ac4d9ae9c1610ac4038 (patch)
treeea5419b2c1c0fc2af22c11e94b4981a9445ec26c /src/reducers/interaction-level.js
parent8302923a08728d36746af3560ebc35685c2b9da5 (diff)
Enable going from room to tile and back
Diffstat (limited to 'src/reducers/interaction-level.js')
-rw-r--r--src/reducers/interaction-level.js25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/reducers/interaction-level.js b/src/reducers/interaction-level.js
index 4b0b3641..5ca917c7 100644
--- a/src/reducers/interaction-level.js
+++ b/src/reducers/interaction-level.js
@@ -1,4 +1,8 @@
-import {GO_FROM_BUILDING_TO_ROOM, GO_FROM_ROOM_TO_BUILDING} from "../actions/interaction-level";
+import {
+ GO_DOWN_ONE_INTERACTION_LEVEL,
+ GO_FROM_BUILDING_TO_ROOM,
+ GO_FROM_ROOM_TO_OBJECT
+} from "../actions/interaction-level";
export function interactionLevel(state = {mode: "BUILDING"}, action) {
switch (action.type) {
@@ -7,10 +11,25 @@ export function interactionLevel(state = {mode: "BUILDING"}, action) {
mode: "ROOM",
roomId: action.roomId
};
- case GO_FROM_ROOM_TO_BUILDING:
+ case GO_FROM_ROOM_TO_OBJECT:
return {
- mode: "BUILDING"
+ mode: "OBJECT",
+ roomId: state.roomId,
+ tileId: action.tileId
};
+ case GO_DOWN_ONE_INTERACTION_LEVEL:
+ if (state.mode === "ROOM") {
+ return {
+ mode: "BUILDING"
+ };
+ } else if (state.mode === "OBJECT") {
+ return {
+ mode: "ROOM",
+ roomId: state.roomId
+ };
+ } else {
+ return state;
+ }
default:
return state;
}