Init
This commit is contained in:
26
Source/FireworkDuels/SpawnManager.cpp
Normal file
26
Source/FireworkDuels/SpawnManager.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// All rights reserved.
|
||||
|
||||
|
||||
#include "SpawnManager.h"
|
||||
|
||||
// Sets default values
|
||||
ASpawnManager::ASpawnManager()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
|
||||
}
|
||||
|
||||
void ASpawnManager::GenerateBoard() {
|
||||
int32 ClassesCount = SpawnableClasses.Num();
|
||||
FVector ActorLocation = this->GetActorLocation();
|
||||
|
||||
for (int32 i = 0; i < BlocksY; i++) {
|
||||
for (int32 o = 0; o < BlocksX; o++) {
|
||||
int32 RandomIndex = FMath::RandRange(0, ClassesCount - 1);
|
||||
FTransform SpawnTransform;
|
||||
SpawnTransform.SetLocation(FVector((ActorLocation.X - (Distance * BlocksX / 2) + (o * Distance)), (ActorLocation.Y - (Distance * (BlocksY / 2)) + (i * Distance)), ActorLocation.Z));
|
||||
GetWorld()->SpawnActor<ABuildingBlock>(SpawnableClasses[RandomIndex], SpawnTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user