This commit is contained in:
Lu 2025-04-13 18:09:07 +02:00
commit 8b84450ea9
11 changed files with 41 additions and 16 deletions

BIN
Content/Legumix/Player/BP_Play.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Player/HUD/T_ShotgunCrosshair.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
Content/Legumix/Spawner/CurveEnemyInWave.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Spawner/CurveMaxEnemyInstantiate.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Spawner/LVL_TestSpawn.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Spawner/WB_DebugWaveWidget.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -74,14 +74,14 @@ bool ALMSpawnPosition::IsPlayerVisible() const
void ALMSpawnPosition::StarCooldown() void ALMSpawnPosition::StarCooldown()
{ {
IsOnCooldow = true; IsOnCooldow = true;
UE_LOG(LogTemp, Warning, TEXT("Spawner Cooldown")); //UE_LOG(LogTemp, Warning, TEXT("Spawner Cooldown"));
GetWorld()->GetTimerManager().SetTimer(ProcessCooldown, this, &ALMSpawnPosition::EndCooldown, TimerCooldown, false); GetWorld()->GetTimerManager().SetTimer(ProcessCooldown, this, &ALMSpawnPosition::EndCooldown, TimerCooldown, false);
} }
void ALMSpawnPosition::EndCooldown() void ALMSpawnPosition::EndCooldown()
{ {
IsOnCooldow = false; IsOnCooldow = false;
UE_LOG(LogTemp, Warning, TEXT("Spawner End Cooldown")); //UE_LOG(LogTemp, Warning, TEXT("Spawner End Cooldown"));
} }

View File

@ -18,7 +18,6 @@ ALMWaveManager::ALMWaveManager()
void ALMWaveManager::BeginPlay() void ALMWaveManager::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
StartWave();
SpawnPositionsList.Empty(); // Nettoie la liste avant de remplir SpawnPositionsList.Empty(); // Nettoie la liste avant de remplir
@ -30,6 +29,8 @@ void ALMWaveManager::BeginPlay()
SpawnPositionsList.Add(SpawnPos); SpawnPositionsList.Add(SpawnPos);
} }
} }
StartWave();
} }
void ALMWaveManager::SpawnEnemy(ALMSpawnPosition* spawnPosition) void ALMWaveManager::SpawnEnemy(ALMSpawnPosition* spawnPosition)
@ -114,9 +115,12 @@ void ALMWaveManager::GetRandomDataWaveRow()
CurrentWaveName = WaveName.ToString(); CurrentWaveName = WaveName.ToString();
FLMWaveStructure* InfoWaveRow = WaveDatePreset->FindRow<FLMWaveStructure>(WaveName, ""); FLMWaveStructure* InfoWaveRow = WaveDatePreset->FindRow<FLMWaveStructure>(WaveName, "");
//Set le nombre d'ennemis dans la wave en fonction de la Row, de la courbe et du nombre de vague passée
EnemyNumberInWave = FMath::CeilToInt((InfoWaveRow->EnemyCount)* CurveForScalingEnemyInWave->GetFloatValue(WaveNumber));
EnemyNumberInWave = InfoWaveRow->EnemyCount; //Set le nombre d'ennemis max spawnés en fonction de la Row, de la courbe, et du nombre de vague passée
MaxEnemyInstantiate = InfoWaveRow->MaxEnemyCount; MaxEnemyInstantiate = FMath::CeilToInt((InfoWaveRow->MaxEnemyCount) * CurveForScalingMaxEnemyInstantiate->GetFloatValue(WaveNumber));
AllEnemyType.Empty(); AllEnemyType.Empty();
for (const FLMEnemyRatio& EnemyRatio : InfoWaveRow->WaveComposition) for (const FLMEnemyRatio& EnemyRatio : InfoWaveRow->WaveComposition)
@ -175,18 +179,18 @@ void ALMWaveManager::Tick(float DeltaTime)
{ {
//lauch break time //lauch break time
// Lance un breaktime avant de relancer une wave // Lance un breaktime avant de relancer une wave
UE_LOG(LogTemp, Warning, TEXT("Start a new wave"));
OnCooldown = true; OnCooldown = true;
GetWorld()->GetTimerManager().SetTimer(BreakTimer, this, &ALMWaveManager::StartWave, BreakTime, false); GetWorld()->GetTimerManager().SetTimer(BreakTimer, this, &ALMWaveManager::StartWave, BreakTime, false);
} }
} }
} }
void ALMWaveManager::StartWave() void ALMWaveManager::StartWave()
{ {
UE_LOG(LogTemp, Warning, TEXT("Start a new wave"));
GetRandomDataWaveRow(); GetRandomDataWaveRow();
EnemySpawned = 0; EnemySpawned = 0;
OnCooldown = false; OnCooldown = false;
WaveNumber++;
} }

View File

@ -35,7 +35,7 @@ public:
int MaxEnemyInstantiate; // Nombre d'ennemis max spawnés int MaxEnemyInstantiate; // Nombre d'ennemis max spawnés
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix") UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
float BreakTime; // Nombre d'ennemis dans la wave float BreakTime;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix") UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
UDataTable* WaveDatePreset; UDataTable* WaveDatePreset;
@ -48,6 +48,15 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix") UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix")
TArray<int> EnemiesPerType; TArray<int> EnemiesPerType;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Legumix")
int WaveNumber = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category="Legumix")
UCurveFloat* CurveForScalingEnemyInWave; // Nombre d'ennemis max spawnés
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category="Legumix")
UCurveFloat* CurveForScalingMaxEnemyInstantiate; // Nombre d'ennemis max spawnés
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned