| 402 | } |
| 403 | |
| 404 | sp<VoxelMap> TileObjectBattleUnit::getVoxelMap(Vec3<int> mapIndex, bool) const |
| 405 | { |
| 406 | auto u = this->getUnit(); |
| 407 | auto size = u->agent->type->bodyType->size.at(u->current_body_state).at(u->facing); |
| 408 | if (mapIndex.x >= size.x || mapIndex.y >= size.y || mapIndex.z >= size.z || mapIndex.x < 0 || |
| 409 | mapIndex.y < 0 || mapIndex.z < 0) |
| 410 | return nullptr; |
| 411 | |
| 412 | return u->agent->type->bodyType->voxelMaps.at(u->current_body_state) |
| 413 | .at(u->facing) |
| 414 | .at(mapIndex.z * size.y * size.x + mapIndex.y * size.x + mapIndex.x); |
| 415 | } |
| 416 | |
| 417 | sp<BattleUnit> TileObjectBattleUnit::getUnit() const { return this->unit.lock(); } |
| 418 | |