diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-26 13:53:21 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:45 +0200 |
| commit | bbb802b4142d11f020994ac4d9ae9c1610ac4038 (patch) | |
| tree | ea5419b2c1c0fc2af22c11e94b4981a9445ec26c /src/actions | |
| parent | 8302923a08728d36746af3560ebc35685c2b9da5 (diff) | |
Enable going from room to tile and back
Diffstat (limited to 'src/actions')
| -rw-r--r-- | src/actions/interaction-level.js | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/actions/interaction-level.js b/src/actions/interaction-level.js index 916648f0..884f1988 100644 --- a/src/actions/interaction-level.js +++ b/src/actions/interaction-level.js @@ -1,15 +1,36 @@ export const GO_FROM_BUILDING_TO_ROOM = "GO_FROM_BUILDING_TO_ROOM"; -export const GO_FROM_ROOM_TO_BUILDING = "GO_FROM_ROOM_TO_BUILDING"; +export const GO_FROM_ROOM_TO_OBJECT = "GO_FROM_ROOM_TO_OBJECT"; +export const GO_DOWN_ONE_INTERACTION_LEVEL = "GO_DOWN_ONE_INTERACTION_LEVEL"; export function goFromBuildingToRoom(roomId) { - return { - type: GO_FROM_BUILDING_TO_ROOM, - roomId + return (dispatch, getState) => { + const {interactionLevel} = getState(); + if (interactionLevel.mode !== "BUILDING") { + return; + } + + dispatch({ + type: GO_FROM_BUILDING_TO_ROOM, + roomId + }); + }; +} + +export function goFromRoomToObject(tileId) { + return (dispatch, getState) => { + const {interactionLevel} = getState(); + if (interactionLevel.mode !== "ROOM") { + return; + } + dispatch({ + type: GO_FROM_ROOM_TO_OBJECT, + tileId + }); }; } -export function goFromRoomToBuilding() { +export function goDownOneInteractionLevel() { return { - type: GO_FROM_ROOM_TO_BUILDING + type: GO_DOWN_ONE_INTERACTION_LEVEL }; } |
