forked from AsphaltWorld/Fnaf-Web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimatronicsReducer.js
More file actions
48 lines (45 loc) · 1.42 KB
/
animatronicsReducer.js
File metadata and controls
48 lines (45 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const originalState = {
Freddy: {
camera: "Stage",
door: false,
jumpscare: false,
},
Bonnie: {
camera: "Stage",
door: false,
jumpscare: false,
},
Chica: {
camera: "Stage",
door: false,
jumpscare: false,
},
Foxy: {
camera: "",
door: false,
jumpscare: false,
},
};
export default function animatronics(state = originalState, action) {
switch (action.type) {
// case "CHANGE_FREDDY_CAMERA":
// return { ...state, Freddy: { ...state.Freddy, camera: action.content } };
// case "CHANGE_BONNIE_CAMERA":
// return { ...state, Bonnie: { ...state.Bonnie, camera: action.content } };
// case "CHANGE_CHICA_CAMERA":
// return { ...state, Chica: { ...state.Chica, camera: action.content } };
// case "CHANGE_FOXY_CAMERA":
// return { ...state, Foxy: { ...state.Foxy, camera: action.content } };
case "CHANGE_ANIMATRONIC":
let animatronicProps = state[action.animatronic];
animatronicProps = { ...action.animatronicState };
state[action.animatronic] = animatronicProps;
return state;
case "SET_FOXY_NULL":
return { ...state, Foxy: { ...state.Foxy, camera: null } };
case "CLEAR_DATA":
return { ...originalState };
default:
return state;
}
}