Implemented Favour Buying System Wituout UI
This commit is contained in:
parent
546e7b4a6d
commit
17916321f2
@ -119,11 +119,68 @@ void ABountyDirector::DestroyActiveSideBounties()
|
||||
UpdateBountyDisplay();
|
||||
}
|
||||
|
||||
// ----------- Favour Shop ---------------
|
||||
|
||||
void ABountyDirector::EarnFavours(int FavoursEarned)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Earned %d favours"), FavoursEarned);
|
||||
Favours += FavoursEarned;
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyCustomBountyAlteration_1()
|
||||
{
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
int Cost = ActiveBounty->GetCustomBountyAlteration_1_Cost();
|
||||
if (Favours < Cost) return;
|
||||
Favours -= Cost;
|
||||
ActiveBounty->BuyCustomBountyAlteration_1();
|
||||
}
|
||||
|
||||
|
||||
void ABountyDirector::BuyCustomBountyAlteration_2()
|
||||
{
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
int Cost = ActiveBounty->GetCustomBountyAlteration_2_Cost();
|
||||
if (Favours < Cost) return;
|
||||
Favours -= Cost;
|
||||
ActiveBounty->BuyCustomBountyAlteration_2();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyCustomBountyAlteration_3()
|
||||
{
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
int Cost = ActiveBounty->GetCustomBountyAlteration_3_Cost();
|
||||
if (Favours < Cost) return;
|
||||
Favours -= Cost;
|
||||
ActiveBounty->BuyCustomBountyAlteration_3();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyAmmoDrop()
|
||||
{
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
if (Favours < 1) return;
|
||||
Favours--;
|
||||
ActiveBounty->BuySpawnAmmoDrops();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyHealthDrop()
|
||||
{
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
if (Favours < 1) return;
|
||||
Favours--;
|
||||
ActiveBounty->BuySpawnHealthDrops();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyEnemyRadio()
|
||||
{
|
||||
if (!IsValid(ActiveBounty)) return;
|
||||
if (Favours < 1) return;
|
||||
Favours--;
|
||||
ActiveBounty->BuyEnemyRadio();
|
||||
}
|
||||
|
||||
void ABountyDirector::BuyFavours()
|
||||
{
|
||||
if (PlayerChar->Money < FavourCost) return;
|
||||
PlayerChar->Money -= FavourCost;
|
||||
Favours++;
|
||||
}
|
@ -20,9 +20,12 @@ class ENDLESSVENDETTA_API ABountyDirector : public AActor
|
||||
UArrowComponent* BountyAttachmentPoint;
|
||||
|
||||
// Ordered Array of Main Bounties
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty Director")
|
||||
TArray<TSubclassOf<AMainBountyClass>> BountyClassArray;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty Director")
|
||||
int FavourCost = 500;
|
||||
|
||||
int CurrentBountyIndex = 0;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category = "Bounty")
|
||||
@ -41,6 +44,7 @@ class ENDLESSVENDETTA_API ABountyDirector : public AActor
|
||||
void FinishActiveBounty();
|
||||
|
||||
protected:
|
||||
int Favours = 0;
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
@ -55,6 +59,27 @@ protected:
|
||||
UFUNCTION()
|
||||
void EarnFavours(int FavoursEarned);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyCustomBountyAlteration_1();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyCustomBountyAlteration_2();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyCustomBountyAlteration_3();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyAmmoDrop();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyHealthDrop();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyEnemyRadio();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bounty Director")
|
||||
void BuyFavours();
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
@ -86,6 +86,8 @@ protected:
|
||||
AGadgetManager* GadgetManager;
|
||||
|
||||
public:
|
||||
int Money = 2000;
|
||||
|
||||
/** Look Input Action */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||
class UInputAction* LookAction;
|
||||
|
Loading…
Reference in New Issue
Block a user