Implemented All Favour Buying Buttons
This commit is contained in:
parent
8b4a78435d
commit
d32b2fc6f5
BIN
EndlessVendetta/Content/BountySystem/BountyDirector/WBP_PC_Display.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/BountySystem/BountyDirector/WBP_PC_Display.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/BountySystem/TestBounties/FavourSystemBountyTest/MainBounty/MB_TestBounty.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/BountySystem/TestBounties/FavourSystemBountyTest/MainBounty/MB_TestBounty.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset
(Stored with Git LFS)
Binary file not shown.
@ -37,7 +37,6 @@ void ABountyDirector::BeginPlay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpawnBountyAndItsSideBounties();
|
SpawnBountyAndItsSideBounties();
|
||||||
UpdateBountyDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::SpawnBountyAndItsSideBounties()
|
void ABountyDirector::SpawnBountyAndItsSideBounties()
|
||||||
@ -97,12 +96,10 @@ void ABountyDirector::FinishActiveBounty()
|
|||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Finished all bounties currently available in the game :)"));
|
UE_LOG(LogTemp, Warning, TEXT("Finished all bounties currently available in the game :)"));
|
||||||
ActiveBounty = nullptr;
|
ActiveBounty = nullptr;
|
||||||
UpdateBountyDisplay();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnBountyAndItsSideBounties();
|
SpawnBountyAndItsSideBounties();
|
||||||
UpdateBountyDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::DestroyActiveSideBounties()
|
void ABountyDirector::DestroyActiveSideBounties()
|
||||||
@ -116,8 +113,6 @@ void ABountyDirector::DestroyActiveSideBounties()
|
|||||||
SideBounty->DestroyCheckpoints();
|
SideBounty->DestroyCheckpoints();
|
||||||
SideBounty->Destroy();
|
SideBounty->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateBountyDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------- Favour Shop ---------------
|
// ----------- Favour Shop ---------------
|
||||||
@ -133,7 +128,8 @@ void ABountyDirector::BuyCustomBountyAlteration_1()
|
|||||||
int Cost = ActiveBounty->GetCustomBountyAlteration_1_Cost();
|
int Cost = ActiveBounty->GetCustomBountyAlteration_1_Cost();
|
||||||
if (Cost == 0 || Favours < Cost) return;
|
if (Cost == 0 || Favours < Cost) return;
|
||||||
Favours -= Cost;
|
Favours -= Cost;
|
||||||
ActiveBounty->BuyCustomBountyAlteration_1();
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
|
ActiveBounty->ActivateCustomBountyAlteration_1();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +139,8 @@ void ABountyDirector::BuyCustomBountyAlteration_2()
|
|||||||
int Cost = ActiveBounty->GetCustomBountyAlteration_2_Cost();
|
int Cost = ActiveBounty->GetCustomBountyAlteration_2_Cost();
|
||||||
if (Cost == 0 || Favours < Cost) return;
|
if (Cost == 0 || Favours < Cost) return;
|
||||||
Favours -= Cost;
|
Favours -= Cost;
|
||||||
ActiveBounty->BuyCustomBountyAlteration_2();
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
|
ActiveBounty->ActivateCustomBountyAlteration_2();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::BuyCustomBountyAlteration_3()
|
void ABountyDirector::BuyCustomBountyAlteration_3()
|
||||||
@ -152,7 +149,8 @@ void ABountyDirector::BuyCustomBountyAlteration_3()
|
|||||||
int Cost = ActiveBounty->GetCustomBountyAlteration_3_Cost();
|
int Cost = ActiveBounty->GetCustomBountyAlteration_3_Cost();
|
||||||
if (Cost == 0 || Favours < Cost) return;
|
if (Cost == 0 || Favours < Cost) return;
|
||||||
Favours -= Cost;
|
Favours -= Cost;
|
||||||
ActiveBounty->BuyCustomBountyAlteration_3();
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
|
ActiveBounty->ActivateCustomBountyAlteration_3();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::BuyAmmoDrop()
|
void ABountyDirector::BuyAmmoDrop()
|
||||||
@ -160,7 +158,8 @@ void ABountyDirector::BuyAmmoDrop()
|
|||||||
if (!IsValid(ActiveBounty)) return;
|
if (!IsValid(ActiveBounty)) return;
|
||||||
if (Favours < 1) return;
|
if (Favours < 1) return;
|
||||||
Favours--;
|
Favours--;
|
||||||
ActiveBounty->BuySpawnAmmoDrops();
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
|
ActiveBounty->SpawnAmmoDrops();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::BuyHealthDrop()
|
void ABountyDirector::BuyHealthDrop()
|
||||||
@ -168,7 +167,8 @@ void ABountyDirector::BuyHealthDrop()
|
|||||||
if (!IsValid(ActiveBounty)) return;
|
if (!IsValid(ActiveBounty)) return;
|
||||||
if (Favours < 1) return;
|
if (Favours < 1) return;
|
||||||
Favours--;
|
Favours--;
|
||||||
ActiveBounty->BuySpawnHealthDrops();
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
|
ActiveBounty->SpawnHealthDrops();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::BuyEnemyRadio()
|
void ABountyDirector::BuyEnemyRadio()
|
||||||
@ -176,7 +176,8 @@ void ABountyDirector::BuyEnemyRadio()
|
|||||||
if (!IsValid(ActiveBounty)) return;
|
if (!IsValid(ActiveBounty)) return;
|
||||||
if (Favours < 1) return;
|
if (Favours < 1) return;
|
||||||
Favours--;
|
Favours--;
|
||||||
ActiveBounty->BuyEnemyRadio();
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
|
ActiveBounty->ActivateEnemyRadio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABountyDirector::BuyFavours()
|
void ABountyDirector::BuyFavours()
|
||||||
@ -184,6 +185,7 @@ void ABountyDirector::BuyFavours()
|
|||||||
if (PlayerChar->Money < FavourCost) return;
|
if (PlayerChar->Money < FavourCost) return;
|
||||||
PlayerChar->Money -= FavourCost;
|
PlayerChar->Money -= FavourCost;
|
||||||
Favours++;
|
Favours++;
|
||||||
|
PC_Display->UpdateFavourCount(Favours);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------- PC Display ---------------
|
// ----------- PC Display ---------------
|
||||||
@ -202,7 +204,7 @@ void ABountyDirector::Interact()
|
|||||||
PlayerController->bEnableClickEvents = true;
|
PlayerController->bEnableClickEvents = true;
|
||||||
PlayerController->bEnableMouseOverEvents = true;
|
PlayerController->bEnableMouseOverEvents = true;
|
||||||
|
|
||||||
UPC_Display* PC_Display = Cast<UPC_Display>(PC_DisplayWidget);
|
PC_Display = Cast<UPC_Display>(PC_DisplayWidget);
|
||||||
bool GameOver = !IsValid(ActiveBounty);
|
bool GameOver = !IsValid(ActiveBounty);
|
||||||
PC_Display->PC_Display_Info.IsGameOver = GameOver;
|
PC_Display->PC_Display_Info.IsGameOver = GameOver;
|
||||||
PC_Display->LogoutFromBountyDirectorPC.AddDynamic(this, &ABountyDirector::DestroyBountyDirectorPCWidget);
|
PC_Display->LogoutFromBountyDirectorPC.AddDynamic(this, &ABountyDirector::DestroyBountyDirectorPCWidget);
|
||||||
@ -248,6 +250,12 @@ void ABountyDirector::Interact()
|
|||||||
|
|
||||||
// Button Delegates
|
// Button Delegates
|
||||||
PC_Display->BuyCba_1.AddDynamic(this, &ABountyDirector::BuyCustomBountyAlteration_1);
|
PC_Display->BuyCba_1.AddDynamic(this, &ABountyDirector::BuyCustomBountyAlteration_1);
|
||||||
|
PC_Display->BuyCba_2.AddDynamic(this, &ABountyDirector::BuyCustomBountyAlteration_2);
|
||||||
|
PC_Display->BuyCba_3.AddDynamic(this, &ABountyDirector::BuyCustomBountyAlteration_3);
|
||||||
|
PC_Display->BuyAmmoDrop.AddDynamic(this, &ABountyDirector::BuyAmmoDrop);
|
||||||
|
PC_Display->BuyHealthDrop.AddDynamic(this, &ABountyDirector::BuyHealthDrop);
|
||||||
|
PC_Display->BuyRadio.AddDynamic(this, &ABountyDirector::BuyEnemyRadio);
|
||||||
|
PC_Display->BuyFavour.AddDynamic(this, &ABountyDirector::BuyFavours);
|
||||||
|
|
||||||
PC_Display->LoadOS();
|
PC_Display->LoadOS();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
|||||||
|
|
||||||
UUserWidget* PC_DisplayWidget;
|
UUserWidget* PC_DisplayWidget;
|
||||||
|
|
||||||
|
UPC_Display* PC_Display;
|
||||||
|
|
||||||
int CurrentBountyIndex = 0;
|
int CurrentBountyIndex = 0;
|
||||||
|
|
||||||
UPROPERTY(VisibleAnywhere, Category = "Bounty")
|
UPROPERTY(VisibleAnywhere, Category = "Bounty")
|
||||||
@ -42,7 +44,6 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
|||||||
TArray<ASideBountyClass*> ActiveSideBounties;
|
TArray<ASideBountyClass*> ActiveSideBounties;
|
||||||
|
|
||||||
// Checks if completed the bounty, and moves onto the next if so
|
// Checks if completed the bounty, and moves onto the next if so
|
||||||
//UFUNCTION(BlueprintCallable, Category = "Bounty")
|
|
||||||
void UpdateBountyProgression();
|
void UpdateBountyProgression();
|
||||||
|
|
||||||
void SpawnBountyAndItsSideBounties();
|
void SpawnBountyAndItsSideBounties();
|
||||||
@ -50,46 +51,45 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
|||||||
// Collect reward for current Bounty and prepare for the next
|
// Collect reward for current Bounty and prepare for the next
|
||||||
void FinishActiveBounty();
|
void FinishActiveBounty();
|
||||||
|
|
||||||
|
// Opens up Bounty Director PC Interface
|
||||||
void Interact() override;
|
void Interact() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int Favours = 20;
|
int Favours = 20;
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
/** Blueprint implemented function called from c++, handles aesthetic changes to bounty display
|
|
||||||
based on data from ActiveBC and ActiveSBC */
|
|
||||||
UFUNCTION(BlueprintImplementableEvent, Category = "bounty")
|
|
||||||
void UpdateBountyDisplay();
|
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void DestroyActiveSideBounties();
|
void DestroyActiveSideBounties();
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void DestroyBountyDirectorPCWidget();
|
void DestroyBountyDirectorPCWidget();
|
||||||
|
|
||||||
|
// Listens for when a side bounty is completed
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void EarnFavours(int FavoursEarned);
|
void EarnFavours(int FavoursEarned);
|
||||||
|
|
||||||
|
// -------- Buy Buttons --------
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void BuyCustomBountyAlteration_1();
|
void BuyCustomBountyAlteration_1();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
UFUNCTION()
|
||||||
void BuyCustomBountyAlteration_2();
|
void BuyCustomBountyAlteration_2();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
UFUNCTION()
|
||||||
void BuyCustomBountyAlteration_3();
|
void BuyCustomBountyAlteration_3();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
UFUNCTION()
|
||||||
void BuyAmmoDrop();
|
void BuyAmmoDrop();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
UFUNCTION()
|
||||||
void BuyHealthDrop();
|
void BuyHealthDrop();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
UFUNCTION()
|
||||||
void BuyEnemyRadio();
|
void BuyEnemyRadio();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
UFUNCTION()
|
||||||
void BuyFavours();
|
void BuyFavours();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -3,22 +3,24 @@
|
|||||||
|
|
||||||
#include "MainBountyClass.h"
|
#include "MainBountyClass.h"
|
||||||
|
|
||||||
void AMainBountyClass::BuySpawnAmmoDrops()
|
void AMainBountyClass::SpawnAmmoDrops()
|
||||||
{
|
{
|
||||||
FActorSpawnParameters SpawnParameters;
|
UE_LOG(LogTemp, Display, TEXT("Bought Ammo Drops, but its not implemented yet"));
|
||||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
// FActorSpawnParameters SpawnParameters;
|
||||||
for (FTransform Spawn : AmmoDropSpawnTransforms)
|
// SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
{
|
// for (FTransform Spawn : AmmoDropSpawnTransforms)
|
||||||
GetWorld()->SpawnActor<AActor>(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
// {
|
||||||
}
|
// GetWorld()->SpawnActor<AActor>(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMainBountyClass::BuySpawnHealthDrops()
|
void AMainBountyClass::SpawnHealthDrops()
|
||||||
{
|
{
|
||||||
FActorSpawnParameters SpawnParameters;
|
UE_LOG(LogTemp, Display, TEXT("Bought Health Drops, but its not implemented yet"));
|
||||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
// FActorSpawnParameters SpawnParameters;
|
||||||
for (FTransform Spawn : HealthDropSpawnTransforms)
|
// SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
{
|
// for (FTransform Spawn : HealthDropSpawnTransforms)
|
||||||
GetWorld()->SpawnActor<AActor>(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
// {
|
||||||
}
|
// GetWorld()->SpawnActor<AActor>(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
||||||
|
// }
|
||||||
}
|
}
|
@ -48,13 +48,13 @@ public:
|
|||||||
|
|
||||||
// ------------- Custom Bounty Alterations -------------
|
// ------------- Custom Bounty Alterations -------------
|
||||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||||
void BuyCustomBountyAlteration_1();
|
void ActivateCustomBountyAlteration_1();
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||||
void BuyCustomBountyAlteration_2();
|
void ActivateCustomBountyAlteration_2();
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||||
void BuyCustomBountyAlteration_3();
|
void ActivateCustomBountyAlteration_3();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Bounty")
|
UFUNCTION(BlueprintCallable, Category = "Bounty")
|
||||||
FString GetCustomBountyAlteration_1_Description()
|
FString GetCustomBountyAlteration_1_Description()
|
||||||
@ -93,12 +93,13 @@ public:
|
|||||||
}
|
}
|
||||||
// ------------- Simple Bounty Alterations -------------
|
// ------------- Simple Bounty Alterations -------------
|
||||||
|
|
||||||
void BuySpawnAmmoDrops();
|
void SpawnAmmoDrops();
|
||||||
|
|
||||||
void BuySpawnHealthDrops();
|
void SpawnHealthDrops();
|
||||||
|
|
||||||
void BuyEnemyRadio()
|
void ActivateEnemyRadio()
|
||||||
{
|
{
|
||||||
|
UE_LOG(LogTemp, Display, TEXT("Bought Radio, but it's not implemented yet"));
|
||||||
HasEnemyRadio = true;
|
HasEnemyRadio = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,29 +47,47 @@ struct FPC_Display_Info
|
|||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLogoutFromBountyDirectorPC);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLogoutFromBountyDirectorPC);
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyCBA_1);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyCBA_1);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyCBA_2);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyCBA_3);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyAmmoDrop);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyHealthDrop);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyRadio);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyFavour);
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class ENDLESSVENDETTA_API UPC_Display : public UUserWidget
|
class ENDLESSVENDETTA_API UPC_Display : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
protected:
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "PC_Display")
|
|
||||||
void LogoutButtonPressed()
|
|
||||||
{
|
|
||||||
LogoutFromBountyDirectorPC.Broadcast();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Button Delegates
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
FLogoutFromBountyDirectorPC LogoutFromBountyDirectorPC;
|
FLogoutFromBountyDirectorPC LogoutFromBountyDirectorPC;
|
||||||
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
FBuyCBA_1 BuyCba_1;
|
FBuyCBA_1 BuyCba_1;
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
|
FBuyCBA_2 BuyCba_2;
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
|
FBuyCBA_3 BuyCba_3;
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
|
FBuyAmmoDrop BuyAmmoDrop;
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
|
FBuyHealthDrop BuyHealthDrop;
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
|
FBuyRadio BuyRadio;
|
||||||
|
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||||
|
FBuyFavour BuyFavour;
|
||||||
|
|
||||||
|
// USTRUCT
|
||||||
UPROPERTY(BlueprintReadOnly)
|
UPROPERTY(BlueprintReadOnly)
|
||||||
FPC_Display_Info PC_Display_Info;
|
FPC_Display_Info PC_Display_Info;
|
||||||
|
|
||||||
|
// Takes USTRUCT and uses its values to fill in widget
|
||||||
UFUNCTION(BlueprintImplementableEvent, Category = "PC_Display")
|
UFUNCTION(BlueprintImplementableEvent, Category = "PC_Display")
|
||||||
void LoadOS();
|
void LoadOS();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintImplementableEvent, Category = "PC_Display")
|
||||||
|
void UpdateFavourCount(int NewFavourCount);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user