Class: Motel::MovementStrategy
- Inherits:
-
Object
- Object
- Motel::MovementStrategy
- Defined in:
- lib/motel/movement_strategy.rb
Overview
MovementStrategy subclasses define the rules and params which a location changes its position.
Direct Known Subclasses
Motel::MovementStrategies::Elliptical, Motel::MovementStrategies::Linear, Motel::MovementStrategies::Stopped
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#step_delay ⇒ Object
Returns the value of attribute step_delay.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ MovementStrategy
constructor
A new instance of MovementStrategy.
-
#move(location, elapsed_seconds) ⇒ Object
default movement strategy is to do nothing.
Constructor Details
#initialize(args = {}) ⇒ MovementStrategy
Returns a new instance of MovementStrategy.
18 19 20 21 22 |
# File 'lib/motel/movement_strategy.rb', line 18 def initialize(args = {}) @step_delay = 1 @step_delay = args[:step_delay] if args.has_key?(:step_delay) && !args[:step_delay].nil? end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
14 15 16 |
# File 'lib/motel/movement_strategy.rb', line 14 def id @id end |
#step_delay ⇒ Object
Returns the value of attribute step_delay.
16 17 18 |
# File 'lib/motel/movement_strategy.rb', line 16 def step_delay @step_delay end |
#type ⇒ Object
Returns the value of attribute type.
14 15 16 |
# File 'lib/motel/movement_strategy.rb', line 14 def type @type end |
Instance Method Details
#move(location, elapsed_seconds) ⇒ Object
default movement strategy is to do nothing
25 26 |
# File 'lib/motel/movement_strategy.rb', line 25 def move(location, elapsed_seconds) end |