Class: GameState
- Inherits:
-
Object
- Object
- GameState
- Defined in:
- lib/lib/game_states/game_state.rb
Overview
Managing of active game states
Direct Known Subclasses
Class Method Summary collapse
-
.switch!(next_state) ⇒ Object
Switch active state to next one.
Instance Method Summary collapse
-
#after_start ⇒ Object
What to do just after state gets activated.
-
#before_end ⇒ Object
What to do just before state gets deactivated.
- #draw ⇒ Object
- #update(button) ⇒ Object
Class Method Details
.switch!(next_state) ⇒ Object
Switch active state to next one
4 5 6 7 8 9 10 11 12 |
# File 'lib/lib/game_states/game_state.rb', line 4 def self.switch!(next_state) #puts 'DEBUG: switching to state ' + next_state.to_s unless $window.state.nil? $window.state.before_end end $window.state = next_state $window.state.after_start end |
Instance Method Details
#after_start ⇒ Object
What to do just after state gets activated
15 16 |
# File 'lib/lib/game_states/game_state.rb', line 15 def after_start end |
#before_end ⇒ Object
What to do just before state gets deactivated
19 20 |
# File 'lib/lib/game_states/game_state.rb', line 19 def before_end end |
#draw ⇒ Object
25 26 |
# File 'lib/lib/game_states/game_state.rb', line 25 def draw end |
#update(button) ⇒ Object
22 23 |
# File 'lib/lib/game_states/game_state.rb', line 22 def update() end |