Sha256: 8c7e0af6cde9124fc6bbb8bd7e4fd4bc70b3daa727f08f715c677c4f9a350562

Contents?: true

Size: 428 Bytes

Versions: 24

Compression:

Stored size: 428 Bytes

Contents

#
#
class Waves
  
  #
  #
  def initialize window
    @window = window
    @waves = {}
  end
  
  #
  #
  def add amount, type, time
    @waves[time] ||= []
    @waves[time] << [amount, type]
  end
  
  #
  #
  def check time
    if wave? time
      types = @waves[time]
      types.each { |amount, type| amount.times { @window.randomly_add type } }
    end
  end
  
  #
  #
  def wave? time
    !@waves[time].nil?
  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
gosu_extensions-0.1.3 lib/waves.rb
gosu_extensions-0.1.2 lib/waves.rb
gosu_extensions-0.1.1 lib/waves.rb
gosu_extensions-0.1.0 lib/waves.rb