GetGIDByPos Get the corresponding grid ID by horizontal and vertical coordinates 通过横纵坐标获取对应的格子ID
(x, y float32)
| 134 | // GetGIDByPos Get the corresponding grid ID by horizontal and vertical coordinates |
| 135 | // 通过横纵坐标获取对应的格子ID |
| 136 | func (m *AOIManager) GetGIDByPos(x, y float32) int { |
| 137 | gx := (int(x) - m.MinX) / m.grIDWIDth() |
| 138 | gy := (int(y) - m.MinY) / m.grIDLength() |
| 139 | |
| 140 | return gy*m.CntsX + gx |
| 141 | } |
| 142 | |
| 143 | // GetPIDsByPos Get all PlayerIDs within the surrounding nine grids by horizontal and vertical coordinates |
| 144 | // 通过横纵坐标得到周边九宫格内的全部PlayerIDs |
no test coverage detected