Class: WinState
- Includes:
- Singleton
- Defined in:
- lib/lib/game_states/win_state.rb
Overview
Game state of summary of won game
Instance Attribute Summary collapse
-
#faction ⇒ Object
readonly
Returns the value of attribute faction.
Instance Method Summary collapse
- #draw ⇒ Object
- #set_victory!(faction, type, turn, score) ⇒ Object
- #unset_victory! ⇒ Object
-
#update(button) ⇒ Object
Process given button.
Methods inherited from GameState
#after_start, #before_end, switch!
Instance Attribute Details
#faction ⇒ Object (readonly)
Returns the value of attribute faction.
11 12 13 |
# File 'lib/lib/game_states/win_state.rb', line 11 def faction @faction end |
Instance Method Details
#draw ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lib/game_states/win_state.rb', line 31 def draw winner_text = "VICTORY FOR FACTION #{@faction}" summary_text = "Summary: victory type: #{@type} won on turn: #{@turn} ending score: #{@score}" = 'Do you want to continue playing? Enter – resume Esc – return to menu' win_summary = Gosu::Image.from_text( winner_text + "\n\n\n" + summary_text + "\n\n" + , 20) win_summary.draw((2*TILESIZE) + XTEXT, (2*TILESIZE) + YTEXT, ZTEXT) end |
#set_victory!(faction, type, turn, score) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/lib/game_states/win_state.rb', line 46 def set_victory!(faction, type, turn, score) @faction = faction @type = type @turn = turn @score = score.clone # separate object is neeeded GameState.switch!(WinState.instance) end |
#unset_victory! ⇒ Object
55 56 57 58 59 60 |
# File 'lib/lib/game_states/win_state.rb', line 55 def unset_victory!() @faction = nil @type = nil @turn = nil @score = nil end |