ActionWithDirection runstate

- setting this runstate with a function as arg will give a direction prompt, and then call the function with the selected direction as the argument. i.e. for opening a door or throwing an item in a specific direction
This commit is contained in:
Llywelwyn 2023-07-24 00:58:40 +01:00
parent 1f6c04a526
commit 3e2eee9709
3 changed files with 91 additions and 3 deletions

View file

@ -56,6 +56,7 @@ pub enum RunState {
ShowDropItem,
ShowRemoveItem,
ShowTargeting { range: i32, item: Entity, aoe: i32 },
ActionWithDirection { function: fn(i: i32, j: i32, ecs: &mut World) -> RunState },
MainMenu { menu_selection: gui::MainMenuSelection },
SaveGame,
GameOver,
@ -398,6 +399,9 @@ impl GameState for State {
}
}
}
RunState::ActionWithDirection { function } => {
new_runstate = gui::get_input_direction(&mut self.ecs, ctx, try_door);
}
RunState::MainMenu { .. } => {
let result = gui::main_menu(self, ctx);
match result {