Class: GuiInterface

Inherits:
Interface show all
Defined in:
lib/zombie-chaser/interface.rb

Instance Attribute Summary

Attributes inherited from Interface

#human, #zombie_list

Instance Method Summary collapse

Methods inherited from Interface

#interface_puts, #sleep

Constructor Details

#initializeGuiInterface

Returns a new instance of GuiInterface.



126
127
128
129
130
131
132
# File 'lib/zombie-chaser/interface.rb', line 126

def initialize
  @window = Window.new
  #Actor.window = @window #Fixme why can't this do the trick?
  Human.window = @window
  Zombie.window = @window
  @window_showing_thread = Thread.new {@window.show}
end

Instance Method Details

#finish_if_neccessaryObject



150
151
152
# File 'lib/zombie-chaser/interface.rb', line 150

def finish_if_neccessary
  @window_showing_thread.join
end

#human=(human) ⇒ Object



138
139
140
# File 'lib/zombie-chaser/interface.rb', line 138

def human=(human)
  @window.human = human
end

#no_living_zombies_apart_from_me?(desired_step_count, actor) ⇒ Boolean

Returns:

  • (Boolean)


146
147
148
# File 'lib/zombie-chaser/interface.rb', line 146

def no_living_zombies_apart_from_me?(desired_step_count, actor)
  @window.no_living_zombies_apart_from_me?(desired_step_count, actor)
end

#something_happenedObject

Doesn’t need to be used, as window updates 60 times a second anyway



135
136
# File 'lib/zombie-chaser/interface.rb', line 135

def something_happened
end

#zombie_list=(zombie_list) ⇒ Object



142
143
144
# File 'lib/zombie-chaser/interface.rb', line 142

def zombie_list=(zombie_list)
  @window.zombie_list = zombie_list
end