Module: ZombieInterface

Included in:
MockZombie, Zombie
Defined in:
lib/zombie-chaser/human.rb

Instance Method Summary collapse

Instance Method Details

#actor_typeObject



262
263
264
# File 'lib/zombie-chaser/human.rb', line 262

def actor_type
  'zombie'
end

#current_symbolObject



251
252
253
254
255
256
257
258
259
260
# File 'lib/zombie-chaser/human.rb', line 251

def current_symbol
  case @health
  when :alive
    "Z"
  when :dying
    "*"
  when :dead
    "+"
  end
end

#eat_humanObject



282
283
284
285
286
287
# File 'lib/zombie-chaser/human.rb', line 282

def eat_human
  @status = :attacking #Even if the human's dead, look for leftovers
  @world.notify_human_eaten
  sleep 1
  @status = nil
end

#increase_angle_by(amount) ⇒ Object



272
273
274
275
276
# File 'lib/zombie-chaser/human.rb', line 272

def increase_angle_by(amount)
  minimum_lurch_offset = -20
  maximum_lurch_offset = 20
  @lurch_offset = (@lurch_offset + amount - minimum_lurch_offset) % (maximum_lurch_offset - minimum_lurch_offset) + minimum_lurch_offset
end

#notify_finishedObject



278
279
280
# File 'lib/zombie-chaser/human.rb', line 278

def notify_finished
  eat_human unless dead?
end

#shuffle_in_one_placeObject



266
267
268
269
270
# File 'lib/zombie-chaser/human.rb', line 266

def shuffle_in_one_place
  shuffle_amount = 17
  increase_angle_by(shuffle_amount)
  sleep 0.1
end