diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index 4234916..ea224c4 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -133,6 +133,7 @@ ManualIPAddress= +Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ") +DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Bullet") +DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Enemy") ++DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="Hitbox") +EditProfiles=(Name="NoCollision",CustomResponses=((Channel="Bullet",Response=ECR_Ignore))) +EditProfiles=(Name="OverlapAll",CustomResponses=((Channel="Bullet",Response=ECR_Overlap))) +EditProfiles=(Name="CharacterMesh",CustomResponses=((Channel="Bullet",Response=ECR_Ignore))) diff --git a/Content/Legumix/Ennemy/BP_HitBox_Head.uasset b/Content/Legumix/Ennemy/BP_HitBox_Head.uasset index 8721ef8..ba20b20 100644 --- a/Content/Legumix/Ennemy/BP_HitBox_Head.uasset +++ b/Content/Legumix/Ennemy/BP_HitBox_Head.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20f31b91addc80e2a14794be9ca0f7be6b8a5b65447234ee2038a7a8155d0b0c -size 17154 +oid sha256:629996c6b1cb3aaa653f44cc99191163e4cf2a00272c0a7e9fad1c1d1a932b4d +size 17256 diff --git a/Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset b/Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset index 656b8c7..43e115d 100644 --- a/Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset +++ b/Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c634f4ba06aa6330a9a86f64559900f00de09d8149add523a07d0bb2bdbfc806 -size 145418 +oid sha256:f24b2c3cefa7230d3cc157f40a4fdc7e65d651414488eb4e46e4db15838f7645 +size 160193 diff --git a/Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset b/Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset index f8d5881..fdf0bca 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a107424ffc6ebb0f23396a35dd508a2d8b9a5db2db575b6630c3ddf4c636b70 -size 3751 +oid sha256:3ec010f9d10c746d023616187617e0ac72835c6db41aba07e35a8e070836234c +size 4061 diff --git a/Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset b/Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset index 0e6df4d..d217f40 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a38163c2ae9205a9e045f96a2b83f45b1e9ec839d2d3dc960ec92ce95f66957 -size 39255 +oid sha256:6b3b48ee54de4057750220a75ab38b05a71851062d1b598cb7af3de7ed2e6a05 +size 27679 diff --git a/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset b/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset index ae5bddb..39130f8 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8bf7ffe8da31caf170e1f29ab0c1f5bbe18f5968ac10245c639b45f31408800 -size 225874 +oid sha256:97fdc909202147f1c14d05189a53f4e47d9e8209c3bb0d478767c57e27bc3063 +size 293774 diff --git a/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset b/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset index bd11337..9e64590 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d0ef574d7a66351e5bfac859899a6433e7347ebc154f3c3b63159aa79cc0d12 -size 68006 +oid sha256:0179947c627b1c142f5f85b322e708be454bfd7bd604860fadbcbb6a00b555cc +size 72155 diff --git a/Content/Legumix/Levels/LVL_TEST_003.umap b/Content/Legumix/Levels/LVL_TEST_003.umap index b671e74..d069e7a 100644 --- a/Content/Legumix/Levels/LVL_TEST_003.umap +++ b/Content/Legumix/Levels/LVL_TEST_003.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be5a3c4f8037a3e5d36e008703873dbbe20587d10e7367f30a8f663d86222699 -size 777854 +oid sha256:6e73f0202b589718e0fd6ffa822dd4a066975a523994584f707ba9c00cd3db34 +size 1001604 diff --git a/Content/Legumix/Levels/_GENERATED/Antoine/CubeGridToolOutput_5CE99485.uasset b/Content/Legumix/Levels/_GENERATED/Antoine/CubeGridToolOutput_5CE99485.uasset index f7b083b..7f588f0 100644 --- a/Content/Legumix/Levels/_GENERATED/Antoine/CubeGridToolOutput_5CE99485.uasset +++ b/Content/Legumix/Levels/_GENERATED/Antoine/CubeGridToolOutput_5CE99485.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8f8f57debf6fcaedde59928ee8f6b0e659f8a0743808176a24f208661bb7b7d -size 329234 +oid sha256:36c7a2e160149f405d83c1366293cf3cff5f136bd4a97186fda217e409fe9455 +size 453639 diff --git a/Content/Legumix/MainMenu/BP_MainMenuMode.uasset b/Content/Legumix/MainMenu/BP_MainMenuMode.uasset index 6d38266..190176e 100644 --- a/Content/Legumix/MainMenu/BP_MainMenuMode.uasset +++ b/Content/Legumix/MainMenu/BP_MainMenuMode.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9dcd6e94c1c16a3b3c1c92b08be9d7d8722a5cb6680b8f5e94f16dfe74f78d28 -size 53532 +oid sha256:5181df60003a27b96477942d2b1c39ce53ccebce3ea2883f82ac2f049789a77b +size 52920 diff --git a/Content/Legumix/Spawner/DT_WavePreset.uasset b/Content/Legumix/Spawner/DT_WavePreset.uasset index 69cfca0..98efd95 100644 --- a/Content/Legumix/Spawner/DT_WavePreset.uasset +++ b/Content/Legumix/Spawner/DT_WavePreset.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c4dc980d10370e54247d6d2b0bd1cd609110484abbbff020f22414b7261c5777 -size 2889 +oid sha256:0a8c14f41d1b2e5c1655d90dbbf4bf5ad091136fc028d831c2791b67dade66f5 +size 3973 diff --git a/Content/Legumix/Spawner/LVL_TestSpawn.umap b/Content/Legumix/Spawner/LVL_TestSpawn.umap index babf3e9..9b6ae55 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:bcb5b01b681fff1a03e31833c07c4f3f7d7201fc37d0f0216cbc4714a96d1526 -size 81157 +oid sha256:36cb7d68cdfa4a650a8d7b5eda3ede2b57ebcd8d308d6b3e6a27ecd35fe5b7fc +size 81266 diff --git a/Source/LegumeMix/Private/LMSpawnPosition.cpp b/Source/LegumeMix/Private/LMSpawnPosition.cpp index 6aaa7ec..c8a727d 100644 --- a/Source/LegumeMix/Private/LMSpawnPosition.cpp +++ b/Source/LegumeMix/Private/LMSpawnPosition.cpp @@ -14,7 +14,7 @@ ALMSpawnPosition::ALMSpawnPosition() } -bool ALMSpawnPosition::CanSpawn() const +bool ALMSpawnPosition::CanSpawn() { return !IsPlayerVisible() && !IsOnCooldow; } @@ -59,7 +59,7 @@ bool ALMSpawnPosition::IsPlayerVisible() const if (bHit) { //UE_LOG(LogTemp, Warning, TEXT("LineTrace Hit: %s"), *HitResult.GetActor()->GetName()); - return HitResult.GetActor() == Player; // Retourne true uniquement si l'acteur touché est le joueur + return (HitResult.GetActor() == Player && !IsOnCooldow); // Retourne true uniquement si l'acteur touché est le joueur } //UE_LOG(LogTemp, Warning, TEXT("LineTrace: No Hit")); @@ -69,12 +69,14 @@ bool ALMSpawnPosition::IsPlayerVisible() const void ALMSpawnPosition::StarCooldown() { IsOnCooldow = true; + 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")); } diff --git a/Source/LegumeMix/Private/LMWaveManager.cpp b/Source/LegumeMix/Private/LMWaveManager.cpp index 2e4427c..d19dc78 100644 --- a/Source/LegumeMix/Private/LMWaveManager.cpp +++ b/Source/LegumeMix/Private/LMWaveManager.cpp @@ -37,7 +37,7 @@ void ALMWaveManager::SpawnEnemy(ALMSpawnPosition* spawnPosition) if (!tempEnemy) { - UE_LOG(LogTemp, Error, TEXT("Failed to spawn enemy!")); + //UE_LOG(LogTemp, Error, TEXT("Failed to spawn enemy!")); return; } spawnPosition->StarCooldown(); @@ -50,7 +50,7 @@ void ALMWaveManager::SpawnEnemy(ALMSpawnPosition* spawnPosition) //bind la method ennemydead à la death de l'ennemis tempEnemy->OnEnemyDeath.AddDynamic(this, &ALMWaveManager::EnemyDead); - UE_LOG(LogTemp, Error, TEXT("Succes to spawn and bind on death method")); + //UE_LOG(LogTemp, Error, TEXT("Succes to spawn and bind on death method")); EnemySpawned++; EnemiesPerType[RandomIndex]--; @@ -65,15 +65,9 @@ void ALMWaveManager::EnemyDead(ALMEnemy* enemyToRemoveFromLife) bool ALMWaveManager::RemainsEnemyToSpawn() { - int TotalEnemies = 0; - - for (int EnemyCount : EnemiesPerType) - { - TotalEnemies += EnemyCount; - } - bool stillToSpawn = TotalEnemies !=0; - bool no = EnemyAliveList.Num() < MaxEnemyInstantiate; - return EnemyNumberInWave != EnemySpawned && no && stillToSpawn; + bool StillToSpawn = TotalOfEnemyToStillSpawn() !=0; + bool NoEnemyLeftToSpawn = EnemyAliveList.Num() < MaxEnemyInstantiate; + return EnemyNumberInWave != EnemySpawned && NoEnemyLeftToSpawn && StillToSpawn; } void ALMWaveManager::CheckForSpawnerOK() @@ -88,6 +82,17 @@ void ALMWaveManager::CheckForSpawnerOK() } } +int ALMWaveManager::TotalOfEnemyToStillSpawn() +{ + int TotalEnemies = 0; + + for (int EnemyCount : EnemiesPerType) + { + TotalEnemies += EnemyCount; + } + return TotalEnemies; +} + void ALMWaveManager::GetRandomDataWaveRow() { TArray RowNames = WaveDatePreset->GetRowNames(); @@ -97,17 +102,18 @@ void ALMWaveManager::GetRandomDataWaveRow() CurrentWaveName = WaveName.ToString(); FLMWaveStructure* InfoWaveRow = WaveDatePreset->FindRow(WaveName, ""); - - //InternalEnemyRatio = InfoWaveRow->WaveComposition; + EnemyNumberInWave = InfoWaveRow->EnemyCount; MaxEnemyInstantiate = InfoWaveRow->MaxEnemyCount; - + + AllEnemyType.Empty(); for (const FLMEnemyRatio& EnemyRatio : InfoWaveRow->WaveComposition) { // Ajoute chaque EnemyType à la liste AllEnemyType.Add(EnemyRatio.EnemyType); } + EnemiesPerType.Empty(); // Récupère les ratios (NbEnemy) et calcule leur somme int32 TotalRatio = 0; for (const FLMEnemyRatio& EnemyRatio : InfoWaveRow->WaveComposition) @@ -140,23 +146,29 @@ void ALMWaveManager::GetRandomDataWaveRow() void ALMWaveManager::Tick(float DeltaTime) { Super::Tick(DeltaTime); - if(RemainsEnemyToSpawn()) + if(!OnCooldown) { - CheckForSpawnerOK(); - if(SpawnPositionsOK.Num() > 0) + if(RemainsEnemyToSpawn()) { - //Choose spawnpoint to spawn - int32 RandomIndex = FMath::RandRange(0, SpawnPositionsOK.Num() - 1); - SpawnEnemy(SpawnPositionsOK[RandomIndex]); - EnemySpawned++; + CheckForSpawnerOK(); + if(SpawnPositionsOK.Num() > 0) + { + //Choose spawnpoint to spawn + int32 RandomIndex = FMath::RandRange(0, SpawnPositionsOK.Num() - 1); + SpawnEnemy(SpawnPositionsOK[RandomIndex]); + } + return; + } + if(TotalOfEnemyToStillSpawn() == 0 && EnemyAliveList.Num() == 0) + { + //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); } } - else - { - //lauch break time - // Lance un timer de 3 secondes avant d'appeler StartWave() - GetWorld()->GetTimerManager().SetTimer(BreakTimer, this, &ALMWaveManager::StartWave, BreakTime, false); - } + } @@ -164,4 +176,5 @@ void ALMWaveManager::StartWave() { GetRandomDataWaveRow(); EnemySpawned = 0; + OnCooldown = false; } diff --git a/Source/LegumeMix/Public/LMSpawnPosition.h b/Source/LegumeMix/Public/LMSpawnPosition.h index 3a118c3..8542849 100644 --- a/Source/LegumeMix/Public/LMSpawnPosition.h +++ b/Source/LegumeMix/Public/LMSpawnPosition.h @@ -16,7 +16,7 @@ public: ALMSpawnPosition(); // Méthode pour vérifier si le spawn est possible - bool CanSpawn() const; + virtual bool CanSpawn(); UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix") float TimerCooldown = 1.5; void StarCooldown(); diff --git a/Source/LegumeMix/Public/LMWaveManager.h b/Source/LegumeMix/Public/LMWaveManager.h index 83ec789..bea087d 100644 --- a/Source/LegumeMix/Public/LMWaveManager.h +++ b/Source/LegumeMix/Public/LMWaveManager.h @@ -43,6 +43,9 @@ public: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix") TArray> AllEnemyType; + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix") + int EnemySpawned = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix") TArray EnemiesPerType; @@ -55,6 +58,7 @@ protected: virtual void EnemyDead(ALMEnemy* enemyToRemoveFromLife); virtual bool RemainsEnemyToSpawn(); virtual void CheckForSpawnerOK(); + virtual int TotalOfEnemyToStillSpawn(); virtual void GetRandomDataWaveRow(); @@ -64,7 +68,7 @@ public: private: TArray SpawnPositionsOK; - int EnemySpawned = 0; FTimerHandle BreakTimer; + bool OnCooldown; };