From 92fa0d28b64b4abd3dba2822ae047a61105ea72a Mon Sep 17 00:00:00 2001 From: sSebster Date: Sun, 13 Apr 2025 17:17:47 +0200 Subject: [PATCH] Updated WaveManager to use curve as parameters + add widget debug --- Content/Legumix/Spawner/CurveEnemyInWave.uasset | 3 +++ .../Spawner/CurveMaxEnemyInstantiate.uasset | 3 +++ Content/Legumix/Spawner/LVL_TestSpawn.umap | 4 ++-- Content/Legumix/Spawner/WB_DebugWaveWidget.uasset | 3 +++ Source/LegumeMix/Private/LMSpawnPosition.cpp | 4 ++-- Source/LegumeMix/Private/LMWaveManager.cpp | 14 +++++++++----- Source/LegumeMix/Public/LMWaveManager.h | 11 ++++++++++- 7 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 Content/Legumix/Spawner/CurveEnemyInWave.uasset create mode 100644 Content/Legumix/Spawner/CurveMaxEnemyInstantiate.uasset create mode 100644 Content/Legumix/Spawner/WB_DebugWaveWidget.uasset diff --git a/Content/Legumix/Spawner/CurveEnemyInWave.uasset b/Content/Legumix/Spawner/CurveEnemyInWave.uasset new file mode 100644 index 0000000..d2713be --- /dev/null +++ b/Content/Legumix/Spawner/CurveEnemyInWave.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:211f21ded83c8ae8f2bffab238f6f41187bbeef06774a9bcf5368f66083834dc +size 4438 diff --git a/Content/Legumix/Spawner/CurveMaxEnemyInstantiate.uasset b/Content/Legumix/Spawner/CurveMaxEnemyInstantiate.uasset new file mode 100644 index 0000000..7422011 --- /dev/null +++ b/Content/Legumix/Spawner/CurveMaxEnemyInstantiate.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4cf7bc325a49870065d324c7612329763c3870879b4edc7896bdf10a8847fa9f +size 4478 diff --git a/Content/Legumix/Spawner/LVL_TestSpawn.umap b/Content/Legumix/Spawner/LVL_TestSpawn.umap index 9aa2c26..02b3c12 100644 --- a/Content/Legumix/Spawner/LVL_TestSpawn.umap +++ b/Content/Legumix/Spawner/LVL_TestSpawn.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ecedf90fe425d082e08ed371e587646a9ca00ba244055c3a596101546e4a6a31 -size 88904 +oid sha256:f2c5bc46e66035a39d7796584b3b676cec30f92b377193201f88fec8e58573a2 +size 89235 diff --git a/Content/Legumix/Spawner/WB_DebugWaveWidget.uasset b/Content/Legumix/Spawner/WB_DebugWaveWidget.uasset new file mode 100644 index 0000000..f9af9ae --- /dev/null +++ b/Content/Legumix/Spawner/WB_DebugWaveWidget.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77f47fed708378f9d00c939d2c90f8d0ad1f526b16732ea594b1451e6e574761 +size 125965 diff --git a/Source/LegumeMix/Private/LMSpawnPosition.cpp b/Source/LegumeMix/Private/LMSpawnPosition.cpp index 74c1c0a..8ec7aef 100644 --- a/Source/LegumeMix/Private/LMSpawnPosition.cpp +++ b/Source/LegumeMix/Private/LMSpawnPosition.cpp @@ -74,14 +74,14 @@ bool ALMSpawnPosition::IsPlayerVisible() const void ALMSpawnPosition::StarCooldown() { 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); } void ALMSpawnPosition::EndCooldown() { IsOnCooldow = false; - UE_LOG(LogTemp, Warning, TEXT("Spawner End Cooldown")); + //UE_LOG(LogTemp, Warning, TEXT("Spawner End Cooldown")); } diff --git a/Source/LegumeMix/Private/LMWaveManager.cpp b/Source/LegumeMix/Private/LMWaveManager.cpp index 999c8aa..085c1db 100644 --- a/Source/LegumeMix/Private/LMWaveManager.cpp +++ b/Source/LegumeMix/Private/LMWaveManager.cpp @@ -18,7 +18,6 @@ ALMWaveManager::ALMWaveManager() void ALMWaveManager::BeginPlay() { Super::BeginPlay(); - StartWave(); SpawnPositionsList.Empty(); // Nettoie la liste avant de remplir @@ -30,6 +29,8 @@ void ALMWaveManager::BeginPlay() SpawnPositionsList.Add(SpawnPos); } } + + StartWave(); } void ALMWaveManager::SpawnEnemy(ALMSpawnPosition* spawnPosition) @@ -114,9 +115,12 @@ void ALMWaveManager::GetRandomDataWaveRow() CurrentWaveName = WaveName.ToString(); FLMWaveStructure* InfoWaveRow = WaveDatePreset->FindRow(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; - MaxEnemyInstantiate = InfoWaveRow->MaxEnemyCount; + //Set le nombre d'ennemis max spawnés en fonction de la Row, de la courbe, et du nombre de vague passée + MaxEnemyInstantiate = FMath::CeilToInt((InfoWaveRow->MaxEnemyCount) * CurveForScalingMaxEnemyInstantiate->GetFloatValue(WaveNumber)); AllEnemyType.Empty(); for (const FLMEnemyRatio& EnemyRatio : InfoWaveRow->WaveComposition) @@ -175,18 +179,18 @@ void ALMWaveManager::Tick(float DeltaTime) { //lauch break time // Lance un breaktime avant de relancer une wave - UE_LOG(LogTemp, Warning, TEXT("Start a new wave")); OnCooldown = true; GetWorld()->GetTimerManager().SetTimer(BreakTimer, this, &ALMWaveManager::StartWave, BreakTime, false); } } - } void ALMWaveManager::StartWave() { + UE_LOG(LogTemp, Warning, TEXT("Start a new wave")); GetRandomDataWaveRow(); EnemySpawned = 0; OnCooldown = false; + WaveNumber++; } diff --git a/Source/LegumeMix/Public/LMWaveManager.h b/Source/LegumeMix/Public/LMWaveManager.h index bea087d..b40087f 100644 --- a/Source/LegumeMix/Public/LMWaveManager.h +++ b/Source/LegumeMix/Public/LMWaveManager.h @@ -35,7 +35,7 @@ public: int MaxEnemyInstantiate; // Nombre d'ennemis max spawnés 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") UDataTable* WaveDatePreset; @@ -48,6 +48,15 @@ public: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix") TArray 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: // Called when the game starts or when spawned