Class: Fet::Ui::Score

Inherits:
Object
  • Object
show all
Defined in:
lib/fet/ui/score.rb

Overview

Shows the UI elements for score

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game) ⇒ Score

Returns a new instance of Score.



13
14
15
16
17
# File 'lib/fet/ui/score.rb', line 13

def initialize(game)
  self.game = game
  self.score = Fet::Score.new
  self.correct_questions = 0
end

Instance Attribute Details

#gameObject

Returns the value of attribute game.



11
12
13
# File 'lib/fet/ui/score.rb', line 11

def game
  @game
end

#scoreObject

Returns the value of attribute score.



11
12
13
# File 'lib/fet/ui/score.rb', line 11

def score
  @score
end

#textObject

Returns the value of attribute text.



11
12
13
# File 'lib/fet/ui/score.rb', line 11

def text
  @text
end

Instance Method Details

#handle_event_loop(event) ⇒ Object



24
25
26
27
# File 'lib/fet/ui/score.rb', line 24

def handle_event_loop(event)
  handle_level_started_event(event)
  handle_level_complete_event(event)
end

#handle_update_loopObject



29
# File 'lib/fet/ui/score.rb', line 29

def handle_update_loop; end

#startObject



19
20
21
22
# File 'lib/fet/ui/score.rb', line 19

def start
  self.text ||= generate_text
  update_text
end