Implemented Overload Modules UI

This commit is contained in:
Rafal Swierczek 2023-10-07 16:40:58 +01:00
parent 56df964103
commit 8b90325502
7 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:599c54946bc53ff3d3ee06fc5c1e8322aa69d8a54380df1e8a63a41c5aefed46 oid sha256:9fccd918d154abe44f38ff143101e53cd24b3e942af805172cf6ffe84b7e7cb3
size 22249 size 109934

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:35b4a02d71c80d38b36dd3e41dcc099477704b99bd7e2785129503a80a20e67e oid sha256:04bfe587aa943c22a21e10962ddfb29aa185a165a9b1862aebbb012c532e5b8f
size 106253 size 108254

View File

@ -3,7 +3,6 @@
#include "OverloadModule.h" #include "OverloadModule.h"
#include "BehaviorTree/BTCompositeNode.h"
#include "Components/SphereComponent.h" #include "Components/SphereComponent.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
@ -21,6 +20,7 @@ void AOverloadModule::Tick(float DeltaSeconds)
{ {
Super::Tick(DeltaSeconds); Super::Tick(DeltaSeconds);
if (GadgetCantBeUsed()) return;
CheckForPotentialHackTarget(); CheckForPotentialHackTarget();
} }
@ -67,7 +67,10 @@ void AOverloadModule::Activate()
void AOverloadModule::FinishedUsing() void AOverloadModule::FinishedUsing()
{ {
IsValid(ClosestEnemy) ? DisplayHackingSuccess() : DisplayHackingFailure();
SpawnExplosiveOnActor(ClosestEnemy);
Super::FinishedUsing(); Super::FinishedUsing();
PlayRechargingAnim(CooldownTime);
} }
void AOverloadModule::ExplodeClosestAliveEnemy() void AOverloadModule::ExplodeClosestAliveEnemy()
@ -90,17 +93,16 @@ void AOverloadModule::ExplodeClosestAliveEnemy()
if (EnemiesInRadius.IsEmpty()) if (EnemiesInRadius.IsEmpty())
{ {
DisplayFailedToFindTarget(); ClosestEnemy = nullptr;
SphereCollision->DestroyComponent(); SphereCollision->DestroyComponent();
return; return;
} }
// Find the closest Enemy in radius // Find the closest Enemy in radius
AActor* ClosestEnemy = EnemiesInRadius[0]; ClosestEnemy = EnemiesInRadius[0];
float Dist = FVector::Distance(PlayerChar->GetActorLocation(), ClosestEnemy->GetActorLocation()); float Dist = FVector::Distance(PlayerChar->GetActorLocation(), ClosestEnemy->GetActorLocation());
if (EnemiesInRadius.Num() < 2) if (EnemiesInRadius.Num() < 2)
{ {
SpawnExplosiveOnActor(ClosestEnemy);
SphereCollision->DestroyComponent(); SphereCollision->DestroyComponent();
return; return;
} }
@ -115,13 +117,13 @@ void AOverloadModule::ExplodeClosestAliveEnemy()
} }
} }
SpawnExplosiveOnActor(ClosestEnemy);
SphereCollision->DestroyComponent(); SphereCollision->DestroyComponent();
} }
void AOverloadModule::SpawnExplosiveOnActor(AActor* ActortoExplode) void AOverloadModule::SpawnExplosiveOnActor(AActor* ActortoExplode)
{ {
if (!IsValid(ActortoExplode)) return;
FActorSpawnParameters SpawnParams; FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
GetWorld()->SpawnActor<AActor>(Explosive, ActortoExplode->GetActorLocation(), ActortoExplode->GetActorRotation(), SpawnParams); GetWorld()->SpawnActor<AActor>(Explosive, ActortoExplode->GetActorLocation(), ActortoExplode->GetActorRotation(), SpawnParams);

View File

@ -22,6 +22,8 @@ class ENDLESSVENDETTA_API AOverloadModule : public ACombatGadget
AActor* PotentialHackTarget; AActor* PotentialHackTarget;
AActor* ClosestEnemy;
// An Array of previously hacked enemies, stops player from hacking the same Dead Enemy // An Array of previously hacked enemies, stops player from hacking the same Dead Enemy
TArray<uint32> HackedEnemies; TArray<uint32> HackedEnemies;
@ -60,8 +62,14 @@ protected:
void DisplayFoundPotentialTarget(); void DisplayFoundPotentialTarget();
UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module")
void DisplayFailedToFindTarget(); void PlayHackingAnim(float Loadingtime);
UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module") UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module")
void PlayHackingAnim(float Loadingtime); void DisplayHackingFailure();
UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module")
void DisplayHackingSuccess();
UFUNCTION(BlueprintImplementableEvent, Category = "Overload Module")
void PlayRechargingAnim(float RechargingTime);
}; };