Class: CfSim::PortalMap

Inherits:
Object
  • Object
show all
Defined in:
lib/cf_sim/portal_map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*portals) ⇒ PortalMap

Returns a new instance of PortalMap.



9
10
11
12
13
14
15
# File 'lib/cf_sim/portal_map.rb', line 9

def initialize(*portals)
  @portals = portals.flatten.dup.freeze
  @cordination_system = CfSim::CordinationSystem.new(@portals.first.latitude, @portals.first.longitude)
  @portal_map = {}
  @point_map = {}
  convert_to_points
end

Instance Attribute Details

#pointsObject (readonly)

Returns the value of attribute points.



7
8
9
# File 'lib/cf_sim/portal_map.rb', line 7

def points
  @points
end

#portalsObject (readonly)

Returns the value of attribute portals.



7
8
9
# File 'lib/cf_sim/portal_map.rb', line 7

def portals
  @portals
end

Instance Method Details

#find_point(portal) ⇒ Object



21
22
23
# File 'lib/cf_sim/portal_map.rb', line 21

def find_point(portal)
  @point_map[portal]
end

#find_portal(point) ⇒ Object



17
18
19
# File 'lib/cf_sim/portal_map.rb', line 17

def find_portal(point)
  @portal_map[point]
end