• R/O
  • SSH

silny-kombat: Commit

Mercurial repo for silny-kombat project


Commit MetaInfo

Révision7f2576f49091e60e533c2f1a751704a46e1d7488 (tree)
l'heure2023-01-26 03:22:16
AuteurSecT <grzegorzstarowicz@gmai...>
CommiterSecT

Message de Log

Refactoring - removed SignalForSM

Change Summary

Modification

diff -r 123dd2680578 -r 7f2576f49091 src/key_processing.rs
--- a/src/key_processing.rs Thu Jan 19 21:55:26 2023 +0100
+++ b/src/key_processing.rs Wed Jan 25 19:22:16 2023 +0100
@@ -113,29 +113,16 @@
113113 fn process_key_result_for_character(&self, character: & mut Character, key_result:KeyEvents) -> Result<Option<character_state_machine::CharacterFSMOutput>, TransitionImpossibleError>
114114 {
115115
116- match self.process_key(key_result) {
117- state_enums::SignalForSM::MoveToRight => character.trigger(character_state_machine::CharacterFSMInput::BackPressed),
118- state_enums::SignalForSM::MoveToLeft => character.trigger(character_state_machine::CharacterFSMInput::FrontPressed),
119- state_enums::SignalForSM::Crouch => character.trigger(character_state_machine::CharacterFSMInput::Crouch),
120- state_enums::SignalForSM::Punch => character.trigger(character_state_machine::CharacterFSMInput::Punch),
121- state_enums::SignalForSM::KeyRelease => character.trigger(character_state_machine::CharacterFSMInput::Released),
122- _ => Err(TransitionImpossibleError)
123- }
124- }
125-
126- fn process_key(&self, key_result: KeyEvents) -> state_enums::SignalForSM {
127- return match key_result {
128- KeyEvents::CharBLeft => state_enums::SignalForSM::MoveToLeft,
129- KeyEvents::CharBRight => state_enums::SignalForSM::MoveToRight,
130- KeyEvents::CharBDown => state_enums::SignalForSM::Crouch,
131- KeyEvents::CharBPunch => state_enums::SignalForSM::Punch,
132- KeyEvents::CharKeyRelease => state_enums::SignalForSM::KeyRelease,
133- KeyEvents::CharLeft => state_enums::SignalForSM::MoveToLeft,
134- KeyEvents::CharRight => state_enums::SignalForSM::MoveToRight,
135- KeyEvents::CharDown => state_enums::SignalForSM::Crouch,
136- KeyEvents::CharPunch => state_enums::SignalForSM::Punch,
137-
138- //_ => { SignalForSM::None }
116+ match key_result {
117+ KeyEvents::CharBLeft => character.trigger(character_state_machine::CharacterFSMInput::FrontPressed),
118+ KeyEvents::CharBRight => character.trigger(character_state_machine::CharacterFSMInput::BackPressed),
119+ KeyEvents::CharBDown => character.trigger(character_state_machine::CharacterFSMInput::Crouch),
120+ KeyEvents::CharBPunch => character.trigger(character_state_machine::CharacterFSMInput::Punch),
121+ KeyEvents::CharKeyRelease => character.trigger(character_state_machine::CharacterFSMInput::Released),
122+ KeyEvents::CharLeft => character.trigger(character_state_machine::CharacterFSMInput::FrontPressed),
123+ KeyEvents::CharRight => character.trigger(character_state_machine::CharacterFSMInput::BackPressed),
124+ KeyEvents::CharDown => character.trigger(character_state_machine::CharacterFSMInput::Crouch),
125+ KeyEvents::CharPunch => character.trigger(character_state_machine::CharacterFSMInput::Punch),
139126 }
140127 }
141128
diff -r 123dd2680578 -r 7f2576f49091 src/state_enums.rs
--- a/src/state_enums.rs Thu Jan 19 21:55:26 2023 +0100
+++ b/src/state_enums.rs Wed Jan 25 19:22:16 2023 +0100
@@ -6,12 +6,3 @@
66 Punching
77 }
88
9-pub enum SignalForSM {
10- None,
11- MoveToRight,
12- MoveToLeft,
13- Crouch,
14- Punch,
15- KeyRelease
16-}
17-
Afficher sur ancien navigateur de dépôt.