Class: Brawl::BasicBot
- Inherits:
-
BasicArenaObject
- Object
- BasicArenaObject
- Brawl::BasicBot
- Extended by:
- Forwardable
- Includes:
- Eventable
- Defined in:
- lib/brawl/basic_bot.rb
Constant Summary collapse
- DECIMAL_PLACES =
1
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Attributes inherited from BasicArenaObject
#clock, #heading, #health, #id, #location, #name
Instance Method Summary collapse
- #damage(damage_points) ⇒ Object
-
#initialize(params = {}) ⇒ BasicBot
constructor
A new instance of BasicBot.
Methods inherited from BasicArenaObject
Constructor Details
#initialize(params = {}) ⇒ BasicBot
Returns a new instance of BasicBot.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/brawl/basic_bot.rb', line 18 def initialize(params={}) @arena = params[:arena] @parts = params[:parts] add_parts(@parts, params) hook_methods_for_listeners super @arena.add_object(self) end |
Instance Attribute Details
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
14 15 16 |
# File 'lib/brawl/basic_bot.rb', line 14 def parts @parts end |
Instance Method Details
#damage(damage_points) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/brawl/basic_bot.rb', line 30 def damage(damage_points) super fire_event(:bot_damaged, properties, :damage, damage_points ) @arena.remove_object(self) if @health <= 0 end |