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();
|
||||
UpdateBountyDisplay();
|
||||
}
|
||||
|
||||
void ABountyDirector::SpawnBountyAndItsSideBounties()
|
||||
@ -97,12 +96,10 @@ void ABountyDirector::FinishActiveBounty()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Finished all bounties currently available in the game :)"));
|
||||
ActiveBounty = nullptr;
|
||||
UpdateBountyDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnBountyAndItsSideBounties();
|
||||
UpdateBountyDisplay();
|
||||
}
|
||||
|
||||
void ABountyDirector::DestroyActiveSideBounties()
|
||||
@ -116,8 +113,6 @@ void ABountyDirector::DestroyActiveSideBounties()
|
||||
SideBounty->DestroyCheckpoints();
|
||||
SideBounty->Destroy();
|
||||
}
|
||||
|
||||
UpdateBountyDisplay();
|
||||
}
|
||||
|
||||
// ----------- Favour Shop ---------------
|
||||
@ -133,7 +128,8 @@ void ABountyDirector::BuyCustomBountyAlteration_1()
|
||||
int Cost = ActiveBounty->GetCustomBountyAlteration_1_Cost();
|
||||
if (Cost == 0 || Favours < Cost) return;
|
||||
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();
|
||||
if (Cost == 0 || Favours < Cost) return;
|
||||
Favours -= Cost;
|
||||
ActiveBounty->BuyCustomBountyAlteration_2();
|
||||
PC_Display->UpdateFavourCount(Favours);
|
||||
ActiveBounty->ActivateCustomBountyAlteration_2();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyCustomBountyAlteration_3()
|
||||
@ -152,7 +149,8 @@ void ABountyDirector::BuyCustomBountyAlteration_3()
|
||||
int Cost = ActiveBounty->GetCustomBountyAlteration_3_Cost();
|
||||
if (Cost == 0 || Favours < Cost) return;
|
||||
Favours -= Cost;
|
||||
ActiveBounty->BuyCustomBountyAlteration_3();
|
||||
PC_Display->UpdateFavourCount(Favours);
|
||||
ActiveBounty->ActivateCustomBountyAlteration_3();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyAmmoDrop()
|
||||
@ -160,7 +158,8 @@ void ABountyDirector::BuyAmmoDrop()
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
if (Favours < 1) return;
|
||||
Favours--;
|
||||
ActiveBounty->BuySpawnAmmoDrops();
|
||||
PC_Display->UpdateFavourCount(Favours);
|
||||
ActiveBounty->SpawnAmmoDrops();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyHealthDrop()
|
||||
@ -168,7 +167,8 @@ void ABountyDirector::BuyHealthDrop()
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
if (Favours < 1) return;
|
||||
Favours--;
|
||||
ActiveBounty->BuySpawnHealthDrops();
|
||||
PC_Display->UpdateFavourCount(Favours);
|
||||
ActiveBounty->SpawnHealthDrops();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyEnemyRadio()
|
||||
@ -176,7 +176,8 @@ void ABountyDirector::BuyEnemyRadio()
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
if (Favours < 1) return;
|
||||
Favours--;
|
||||
ActiveBounty->BuyEnemyRadio();
|
||||
PC_Display->UpdateFavourCount(Favours);
|
||||
ActiveBounty->ActivateEnemyRadio();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyFavours()
|
||||
@ -184,6 +185,7 @@ void ABountyDirector::BuyFavours()
|
||||
if (PlayerChar->Money < FavourCost) return;
|
||||
PlayerChar->Money -= FavourCost;
|
||||
Favours++;
|
||||
PC_Display->UpdateFavourCount(Favours);
|
||||
}
|
||||
|
||||
// ----------- PC Display ---------------
|
||||
@ -202,7 +204,7 @@ void ABountyDirector::Interact()
|
||||
PlayerController->bEnableClickEvents = true;
|
||||
PlayerController->bEnableMouseOverEvents = true;
|
||||
|
||||
UPC_Display* PC_Display = Cast<UPC_Display>(PC_DisplayWidget);
|
||||
PC_Display = Cast<UPC_Display>(PC_DisplayWidget);
|
||||
bool GameOver = !IsValid(ActiveBounty);
|
||||
PC_Display->PC_Display_Info.IsGameOver = GameOver;
|
||||
PC_Display->LogoutFromBountyDirectorPC.AddDynamic(this, &ABountyDirector::DestroyBountyDirectorPCWidget);
|
||||
@ -248,6 +250,12 @@ void ABountyDirector::Interact()
|
||||
|
||||
// Button Delegates
|
||||
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();
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
||||
|
||||
UUserWidget* PC_DisplayWidget;
|
||||
|
||||
UPC_Display* PC_Display;
|
||||
|
||||
int CurrentBountyIndex = 0;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category = "Bounty")
|
||||
@ -42,7 +44,6 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
||||
TArray<ASideBountyClass*> ActiveSideBounties;
|
||||
|
||||
// Checks if completed the bounty, and moves onto the next if so
|
||||
//UFUNCTION(BlueprintCallable, Category = "Bounty")
|
||||
void UpdateBountyProgression();
|
||||
|
||||
void SpawnBountyAndItsSideBounties();
|
||||
@ -50,46 +51,45 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
|
||||
// Collect reward for current Bounty and prepare for the next
|
||||
void FinishActiveBounty();
|
||||
|
||||
// Opens up Bounty Director PC Interface
|
||||
void Interact() override;
|
||||
|
||||
protected:
|
||||
int Favours = 20;
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
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()
|
||||
void DestroyActiveSideBounties();
|
||||
|
||||
UFUNCTION()
|
||||
void DestroyBountyDirectorPCWidget();
|
||||
|
||||
// Listens for when a side bounty is completed
|
||||
UFUNCTION()
|
||||
void EarnFavours(int FavoursEarned);
|
||||
|
||||
// -------- Buy Buttons --------
|
||||
UFUNCTION()
|
||||
void BuyCustomBountyAlteration_1();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
UFUNCTION()
|
||||
void BuyCustomBountyAlteration_2();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
UFUNCTION()
|
||||
void BuyCustomBountyAlteration_3();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
UFUNCTION()
|
||||
void BuyAmmoDrop();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
UFUNCTION()
|
||||
void BuyHealthDrop();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
UFUNCTION()
|
||||
void BuyEnemyRadio();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
UFUNCTION()
|
||||
void BuyFavours();
|
||||
|
||||
public:
|
||||
|
@ -3,22 +3,24 @@
|
||||
|
||||
#include "MainBountyClass.h"
|
||||
|
||||
void AMainBountyClass::BuySpawnAmmoDrops()
|
||||
void AMainBountyClass::SpawnAmmoDrops()
|
||||
{
|
||||
FActorSpawnParameters SpawnParameters;
|
||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
for (FTransform Spawn : AmmoDropSpawnTransforms)
|
||||
{
|
||||
GetWorld()->SpawnActor<AActor>(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
||||
}
|
||||
UE_LOG(LogTemp, Display, TEXT("Bought Ammo Drops, but its not implemented yet"));
|
||||
// FActorSpawnParameters SpawnParameters;
|
||||
// SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
// for (FTransform Spawn : AmmoDropSpawnTransforms)
|
||||
// {
|
||||
// GetWorld()->SpawnActor<AActor>(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
||||
// }
|
||||
}
|
||||
|
||||
void AMainBountyClass::BuySpawnHealthDrops()
|
||||
void AMainBountyClass::SpawnHealthDrops()
|
||||
{
|
||||
FActorSpawnParameters SpawnParameters;
|
||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
for (FTransform Spawn : HealthDropSpawnTransforms)
|
||||
{
|
||||
GetWorld()->SpawnActor<AActor>(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
||||
}
|
||||
UE_LOG(LogTemp, Display, TEXT("Bought Health Drops, but its not implemented yet"));
|
||||
// FActorSpawnParameters SpawnParameters;
|
||||
// SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
// for (FTransform Spawn : HealthDropSpawnTransforms)
|
||||
// {
|
||||
// GetWorld()->SpawnActor<AActor>(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
|
||||
// }
|
||||
}
|
@ -48,13 +48,13 @@ public:
|
||||
|
||||
// ------------- Custom Bounty Alterations -------------
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||
void BuyCustomBountyAlteration_1();
|
||||
void ActivateCustomBountyAlteration_1();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||
void BuyCustomBountyAlteration_2();
|
||||
void ActivateCustomBountyAlteration_2();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||
void BuyCustomBountyAlteration_3();
|
||||
void ActivateCustomBountyAlteration_3();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty")
|
||||
FString GetCustomBountyAlteration_1_Description()
|
||||
@ -93,12 +93,13 @@ public:
|
||||
}
|
||||
// ------------- 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;
|
||||
}
|
||||
|
||||
|
@ -47,29 +47,47 @@ struct FPC_Display_Info
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLogoutFromBountyDirectorPC);
|
||||
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()
|
||||
class ENDLESSVENDETTA_API UPC_Display : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
protected:
|
||||
UFUNCTION(BlueprintCallable, Category = "PC_Display")
|
||||
void LogoutButtonPressed()
|
||||
{
|
||||
LogoutFromBountyDirectorPC.Broadcast();
|
||||
}
|
||||
|
||||
public:
|
||||
// Button Delegates
|
||||
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||
FLogoutFromBountyDirectorPC LogoutFromBountyDirectorPC;
|
||||
UPROPERTY(BlueprintCallable, Category = PC_Display)
|
||||
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)
|
||||
FPC_Display_Info PC_Display_Info;
|
||||
|
||||
// Takes USTRUCT and uses its values to fill in widget
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "PC_Display")
|
||||
void LoadOS();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "PC_Display")
|
||||
void UpdateFavourCount(int NewFavourCount);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user