Module: Nimo::Behavior::Projectile
- Includes:
- WithVelocity
- Defined in:
- lib/nimo/behavior/projectile.rb
Instance Attribute Summary
Attributes included from WithVelocity
Instance Method Summary collapse
Instance Method Details
#initialize(*params) ⇒ Object
6 7 8 9 |
# File 'lib/nimo/behavior/projectile.rb', line 6 def initialize(*params) @deflectors = [] super(*params) end |
#move ⇒ Object
11 12 13 14 |
# File 'lib/nimo/behavior/projectile.rb', line 11 def move @deflectors.each { |deflector| deflector.deflect(self) } super end |
#with_deflectors(*new_deflectors) ⇒ Object
16 17 18 19 |
# File 'lib/nimo/behavior/projectile.rb', line 16 def with_deflectors(*new_deflectors) @deflectors += new_deflectors @deflectors.flatten! end |