Method: Sc2::Player::Debug#debug_tile
- Defined in:
- lib/sc2ai/player/debug.rb
#debug_tile(pos = nil, x: nil, y: nil, color: nil, indent: 0.05) ⇒ Object
Renders a block on the floor, drawn by 4 lines Pass in either a pos (Position/Unit) or exact x * y coordinates Optional indentation adds padding on borders inward
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/sc2ai/player/debug.rb', line 164 def debug_tile(pos = nil, x: nil, y: nil, color: nil, indent: 0.05) if pos.is_a?(Api::Unit) x = pos.pos.x.floor y = pos.pos.y.floor elsif pos.is_a?(Sc2::Position) x = pos.x.floor y = pos.y.floor end # Raise above floor to prevent texture clipping z = geo.terrain_height(x:, y:).to_f + 0.1 tl = Api::Point[x + indent, y + 1.0 - indent, z] bl = Api::Point[x + indent, y + indent, z] br = Api::Point[x + 1.0 - indent, y + indent, z] tr = Api::Point[x + 1.0 - indent, y + 1.0 - indent, z] debug_draw_line(p0: tl, p1: bl, color:) debug_draw_line(p0: bl, p1: br, color:) debug_draw_line(p0: br, p1: tr, color:) debug_draw_line(p0: tr, p1: tl, color:) end |