| 282 | } |
| 283 | |
| 284 | void World::destroy_unit(UnitId unit) |
| 285 | { |
| 286 | Array<UnitId> unit_lookup(default_scratch_allocator()); |
| 287 | |
| 288 | collect_units(&unit_lookup, _scene_graph, unit); |
| 289 | script_world::unspawned(*_script_world, array::begin(unit_lookup), array::size(unit_lookup)); |
| 290 | |
| 291 | for (u32 i = 0; i < array::size(unit_lookup); ++i) { |
| 292 | _unit_manager->destroy(unit_lookup[i]); |
| 293 | post_unit_destroyed_event(unit_lookup[i]); |
| 294 | } |
| 295 | |
| 296 | remove_dead_units(); |
| 297 | } |
| 298 | |
| 299 | u32 World::num_units() const |
| 300 | { |