Class: RTanque::Bot::Radar::Reflection

Inherits:
Struct
  • Object
show all
Defined in:
lib/rtanque/bot/radar.rb

Overview

A Reflection is the information obtained for a bot detected by RTanque::Bot::Radar

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#distanceFloat (readonly)

Returns the current value of distance.

Returns:

  • (Float)

    the current value of distance



15
16
17
# File 'lib/rtanque/bot/radar.rb', line 15

def distance
  @distance
end

#headingRTanque::Heading (readonly)

Returns the current value of heading.

Returns:



15
16
17
# File 'lib/rtanque/bot/radar.rb', line 15

def heading
  @heading
end

#nameString (readonly)

Returns the current value of name.

Returns:

  • (String)

    the current value of name



15
16
17
# File 'lib/rtanque/bot/radar.rb', line 15

def name
  @name
end

Class Method Details

.new_from_points(from_position, to_position, &tap) ⇒ Object



16
17
18
# File 'lib/rtanque/bot/radar.rb', line 16

def self.new_from_points(from_position, to_position, &tap)
  self.new(from_position.heading(to_position), from_position.distance(to_position)).tap(&tap)
end