void UCheatManager::RebuildNavigation() { UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld()); if (NavSys) { NavSys->Build(); } }
//======================================================================== void AHexEditorActor::LoadMap(const FString& name) { ClearAll(); std::ifstream file(*name, std::ifstream::binary); if (!file.good()) { print(TEXT("no such map file!")); return; } unsigned count = 0; binary_read(file, count); //tiles for (unsigned i = 0; i < count; ++i) { AHexTileActor* tile; if (i == 0) { tile = this; } else { tile = GetWorld()->SpawnActor<AHexTileActor>(); tile->Init({ 0,0,0 }); //tmp coords; } tile->Load(file); m_Grid.InsertElement(tile->GetCoordinates(), tile); } binary_read(file, count); //barriers for (unsigned i = 0; i < count; ++i) { CreateBarrierForPlacing(); m_CurrentBarrier->Load(file); PlaceBarrier(false); } binary_read(file, count); //platforms for (unsigned i = 0; i < count; ++i) { CreatePlatformForPlacing(); m_CurrentPlatform->Load(file); PlacePlatform(false); } binary_read(file, count); //companions for (unsigned i = 0; i < count; ++i) { auto* companion = GetWorld()->SpawnActor<ACompanionActor>(); m_AllCompanions.insert(companion); companion->Load(file); } binary_read(file, count); //blocker for (unsigned i = 0; i < count; ++i) { auto* blocker = GetWorld()->SpawnActor<ABlockerActor>(); m_AllBlockers.insert(blocker); blocker->Load(file); } binary_read(file, count); //bridges for (unsigned i = 0; i < count; ++i) { auto* bridge = GetWorld()->SpawnActor<ABridgeActor>(); m_AllBridges.insert(bridge); bridge->Load(file); } binary_read(file, count); //turret for (unsigned i = 0; i < count; ++i) { auto* turret = GetWorld()->SpawnActor<ATurretActor>(); m_AllTurrets.insert(turret); turret->Load(file); } binary_read(file, count); //teleport for (unsigned i = 0; i < count; ++i) { auto* teleport = GetWorld()->SpawnActor<ATeleportActor>(); m_AllTeleports.insert(teleport); teleport->Load(file); } for (auto* t : m_AllTeleports) { t->PostLoad(); } AFinishActor* finish; binary_read(file, finish); //finish if (finish) { m_Finish = GetWorld()->SpawnActor<AFinishActor>(); m_Finish->Load(file); } file.close(); m_PortalAI->Generate(); UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld()); if (NavSys) { NavSys->Build(); } }