Compare commits

..

No commits in common. "109da799f2a7fec6a767a492e2244ecfee37283c" and "1a3516c263dbdf42e33eb0fb79f5242becb03e57" have entirely different histories.

10 changed files with 10 additions and 87 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -19,15 +19,8 @@ void AVampireGameMode::BeginPlay()
Super::BeginPlay();
PlayerCharacter = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
PlayerController = Cast<AVampirePlayerController>(UGameplayStatics::GetPlayerController(PlayerCharacter, 0));
if (UHealthComponent* HealthComponent = PlayerCharacter->GetHealthComponent())
{
HealthComponent->OnDeath.AddDynamic(this, &AVampireGameMode::OnPlayerDeath);
HealthComponent->OnDeath.AddDynamic(PlayerController, &AVampirePlayerController::OnDeath);
}
GetWorldTimerManager().SetTimer(SpawnEnemyTimerDelegate, this, &AVampireGameMode::SpawnEnemy, 1.0f, true);
}
@ -36,10 +29,10 @@ int AVampireGameMode::GetEnemyDeathCount()
return EnemyDeathCount;
}
void AVampireGameMode::HandleOnEnemyDeath(FDamageInfo DamageInfo)
void AVampireGameMode::HandleOnEnemyDeath(FDamageInfo damageInfo)
{
IncrementEnemyDeathCount();
EnemyObjectPoolManager->ReturnObject(DamageInfo.DamagedActor);
EnemyObjectPoolManager->ReturnObject(damageInfo.DamagedActor);
OnEnemyDeathCountIncrementDelegate.Broadcast(EnemyDeathCount);
}
@ -156,11 +149,6 @@ void AVampireGameMode::AddRandomEnemyTypeToPool()
}
}
void AVampireGameMode::OnPlayerDeath(FDamageInfo DamageInfo)
{
GetWorldTimerManager().ClearTimer(SpawnEnemyTimerDelegate);
}
void AVampireGameMode::EndGame()
{
UKismetSystemLibrary::QuitGame(GetWorld(), UGameplayStatics::GetPlayerController(GetWorld(), 0), EQuitPreference::Quit, true);

View File

@ -71,7 +71,7 @@ public:
protected:
UFUNCTION()
void HandleOnEnemyDeath(FDamageInfo DamageInfo);
void HandleOnEnemyDeath(FDamageInfo damageInfo);
UFUNCTION()
void IncrementEnemyDeathCount();
@ -85,9 +85,6 @@ protected:
UFUNCTION(BlueprintCallable)
void AddRandomEnemyTypeToPool();
UFUNCTION()
void OnPlayerDeath(FDamageInfo DamageInfo);
UFUNCTION(BlueprintCallable)
void EndGame();

View File

@ -15,7 +15,6 @@
#include "Blueprint/UserWidget.h"
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "Widgets/GameOverWidget.h"
#include "Widgets/HUDWidget.h"
#include "Widgets/LevelUpWidget.h"
#include "Widgets/PauseWidget.h"
@ -133,24 +132,6 @@ void AVampirePlayerController::OnPause(const FInputActionValue& PauseInput)
}
}
void AVampirePlayerController::OnDeath(FDamageInfo DamageInfo)
{
if (GameOverUI)
{
if (CurrentPlayerHUD) { CurrentPlayerHUD->RemoveFromParent(); }
if (CurrentLevelUpUI) { CurrentLevelUpUI->RemoveFromParent(); }
if (CurrentPauseUI) { CurrentPauseUI->RemoveFromParent(); }
CurrentGameOverUI = CreateWidget<UGameOverWidget, AVampirePlayerController*>(this, GameOverUI.Get());
if (CurrentGameOverUI)
{
CurrentGameOverUI->AddToViewport();
UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(this, CurrentPauseUI, EMouseLockMode::LockInFullscreen);
bShowMouseCursor = true;
}
}
}
void AVampirePlayerController::UpdatePlayerEXPHUD(int Exp, float CurrentLevelPercent)
{
if (CurrentPlayerHUD)

View File

@ -7,14 +7,11 @@
#include "Interfaces/Playerable.h"
#include "VampirePlayerController.generated.h"
struct FDamageInfo;
class UGameOverWidget;
class ULevelUpWidget;
class UPauseWidget;
struct FInputActionValue;
class UInputAction;
class UHUDWidget;
/**
*
*/
@ -25,18 +22,15 @@ class VAMPIRES_API AVampirePlayerController : public APlayerController, public I
public:
// UI
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<UHUDWidget> PlayerHUD = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<UPauseWidget> PauseUI = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<ULevelUpWidget> LevelUpUI = nullptr;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<UGameOverWidget> GameOverUI = nullptr;
// Inputs
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TObjectPtr<UInputAction> MovementAction;
@ -45,6 +39,7 @@ public:
TObjectPtr<UInputAction> PauseAction;
private:
UPROPERTY()
TObjectPtr<UHUDWidget> CurrentPlayerHUD = nullptr;
@ -54,15 +49,8 @@ private:
UPROPERTY()
TObjectPtr<ULevelUpWidget> CurrentLevelUpUI = nullptr;
UPROPERTY()
TObjectPtr<UGameOverWidget> CurrentGameOverUI = nullptr;
FTimerHandle PawnLifeTimeHandle;
public:
UFUNCTION()
void OnDeath(FDamageInfo DamageInfo);
protected:
virtual void OnPossess(APawn* aPawn) override;
@ -76,7 +64,6 @@ protected:
UFUNCTION()
void OnPause(const FInputActionValue& PauseInput);
UFUNCTION()
void UpdatePlayerEXPHUD(int Exp, float CurrentLevelPercent);

View File

@ -1,4 +0,0 @@
// Louis Hobbs | 2024-2025
#include "GameOverWidget.h"

View File

@ -1,16 +0,0 @@
// Louis Hobbs | 2024-2025
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "GameOverWidget.generated.h"
/**
*
*/
UCLASS()
class VAMPIRES_API UGameOverWidget : public UUserWidget
{
GENERATED_BODY()
};

View File

@ -22,11 +22,7 @@ void UUpgradeButtonDataObject::SetData(TSubclassOf<AWeapon> Weapon, UUserWidget*
{
if (AWeapon* tempWeapon = NewObject<AWeapon>(this, Weapon))
{
WeaponName = tempWeapon->GetWeaponName();
WeaponDescription = tempWeapon->GetDescription();
WeaponIcon = tempWeapon->GetIcon();
WeaponTemplate = Weapon;
Parent = ParentWidget;
SetData(tempWeapon, ParentWidget);
}
}