Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/sc2ai/overrides/array.rb

Overview

Array extensions

Instance Method Summary collapse

Instance Method Details

#to_p2dApi::Point2D

Creates a Point2D from 0,1 as x,y

Returns:



11
12
13
# File 'lib/sc2ai/overrides/array.rb', line 11

def to_p2d
  Api::Point2D.new(x: at(0), y: at(1))
end

#to_unit_groupSc2::UnitGroup

Turns an Array of Api::Unit into a Sc2::UnitGroup

Returns:



5
6
7
# File 'lib/sc2ai/overrides/array.rb', line 5

def to_unit_group
  Sc2::UnitGroup.new(self)
end