Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
48933a4796
@ -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)))
|
||||
|
BIN
Content/Legumix/Ennemy/BP_HitBox_Head.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/BP_HitBox_Head.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Levels/LVL_TEST_003.umap
(Stored with Git LFS)
BIN
Content/Legumix/Levels/LVL_TEST_003.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Levels/_GENERATED/Antoine/CubeGridToolOutput_5CE99485.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Levels/_GENERATED/Antoine/CubeGridToolOutput_5CE99485.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/MainMenu/BP_MainMenuMode.uasset
(Stored with Git LFS)
BIN
Content/Legumix/MainMenu/BP_MainMenuMode.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Spawner/DT_WavePreset.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Spawner/DT_WavePreset.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Spawner/LVL_TestSpawn.umap
(Stored with Git LFS)
BIN
Content/Legumix/Spawner/LVL_TestSpawn.umap
(Stored with Git LFS)
Binary file not shown.
@ -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"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<FName> RowNames = WaveDatePreset->GetRowNames();
|
||||
@ -97,17 +102,18 @@ void ALMWaveManager::GetRandomDataWaveRow()
|
||||
|
||||
CurrentWaveName = WaveName.ToString();
|
||||
FLMWaveStructure* InfoWaveRow = WaveDatePreset->FindRow<FLMWaveStructure>(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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -43,6 +43,9 @@ public:
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix")
|
||||
TArray<TSubclassOf<ALMEnemy>> AllEnemyType;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix")
|
||||
int EnemySpawned = 0;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Legumix")
|
||||
TArray<int> 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<ALMSpawnPosition*> SpawnPositionsOK;
|
||||
int EnemySpawned = 0;
|
||||
|
||||
FTimerHandle BreakTimer;
|
||||
bool OnCooldown;
|
||||
};
|
||||
|
Reference in New Issue
Block a user