작업 내용
- 캠퍼 리스트 UI 추가
- 캠퍼 캐릭터들 HP 줄어드는 모습이 더 잘보였으면해서 UI 추가함.
- 캠퍼 캐릭터들 HP 줄어드는 모습이 더 잘보였으면해서 UI 추가함.
- 싱글톤 패턴 적용
- 목적: 일부 매니져 검증 소스 줄이기
- 1. Get 함수
//MainGS.cpp ABuildingManager* AMainGS::GetBuildingManager() { ABuildingManager* instance = Cast<ABuildingManager>(UGameplayStatics::GetActorOfClass(GetWorld(), ABuildingManager::StaticClass())); if (instance) { return instance; } else { instance = GetWorld()->SpawnActor<ABuildingManager>(); #if WITH_EDITOR instance->SetFolderPath(TEXT("/Managers")); #endif // WITH_EDITOR return instance; } }
- 2. 싱글톤 패턴 함수
//BuildingManager.cpp ABuildingManager* ABuildingManager::Instance_; ABuildingManager* ABuildingManager::GetInstance() { ABuildingManager* BM; if (Instance_) { BM = Instance_; } else { UWorld* world = GEngine->GameViewport->GetWorld(); BM = Cast<ABuildingManager>(UGameplayStatics::GetActorOfClass(world, ABuildingManager::StaticClass())); if (!BM) { BM = world->SpawnActor<ABuildingManager>(); #if WITH_EDITOR BM->SetFolderPath(TEXT("/Managers")); #endif // WITH_EDITOR } } return BM; }
'GameDevelopmentDiary > Project_AC : 가제(목업)' 카테고리의 다른 글
27-29 (0) | 2021.07.22 |
---|---|
23 - 25일차 (0) | 2021.07.22 |
19 - 22일차 (0) | 2021.06.25 |
12 - 18일차 (0) | 2021.06.25 |
8 - 11 일차 (0) | 2021.06.21 |