Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void UEnemySubsystem::RequestEnemy()
- {
- if(TotalEnemiesToSpawnThisRound-- == 0)
- {
- GetWorld()->GetTimerManager().ClearTimer(EnemySpawnTimerHandle);
- EnemySpawnTimerHandle.Invalidate();
- return;
- }
- // Clear and invalidate the timer if the remaining enemies to spawn is 0
- const auto SpawnPoint = GetRandomEnemySpawnPoint();
- const auto Controller = mFreeControllers.Pop(true); // take out a free controller
- Controller->SpawnPawn(SpawnPoint); // spawn the pawn
- mAllocatedController.Add(Controller); // add it to the allocated controller
- }
Advertisement
Add Comment
Please, Sign In to add comment