Implemented Simple Bounty Alterations

This commit is contained in:
Rafal Swierczek 2023-10-10 19:54:01 +01:00
parent 3c1d16c967
commit c6db0146e4
2 changed files with 102 additions and 21 deletions

View File

@ -93,4 +93,26 @@ void ABountyClass::CollectRewards_Implementation()
UE_LOG(LogTemp, Warning, TEXT("The player has gained $%d for completing the bounty!"), RewardMoney); UE_LOG(LogTemp, Warning, TEXT("The player has gained $%d for completing the bounty!"), RewardMoney);
} }
void ABountyClass::BuySpawnAmmoDrops()
{
FActorSpawnParameters SpawnParameters;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
for (FTransform Spawn : AmmoDropSpawnTransforms)
{
GetWorld()->SpawnActor<AActor>(AmmoDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
}
}
void ABountyClass::BuySpawnHealthDrops()
{
FActorSpawnParameters SpawnParameters;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
for (FTransform Spawn : HealthDropSpawnTransforms)
{
GetWorld()->SpawnActor<AActor>(HealthDropClass, Spawn.GetLocation(), Spawn.GetRotation().Rotator(), SpawnParameters);
}
}

View File

@ -35,15 +35,38 @@ protected:
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString BountyDesc; FString BountyDesc;
// ---------------- Bounty Alterations ----------------
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomBountyAlteration_1_Description;
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomAlteringEffect1_Description; int CustomBountyAlteration_1_Cost = 2;
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomAlteringEffect2_Description; FString CustomBountyAlteration_2_Description;
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomAlteringEffect3_Description; int CustomBountyAlteration_2_Cost = 2;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomBountyAlteration_3_Description;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
int CustomBountyAlteration_3_Cost = 2;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
TArray<FTransform> AmmoDropSpawnTransforms;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
TSubclassOf<AActor> AmmoDropClass;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
TArray<FTransform> HealthDropSpawnTransforms;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
TSubclassOf<AActor> HealthDropClass;
bool HasEnemyRadio = false;
// ----------------------------------------------- // -----------------------------------------------
@ -138,30 +161,66 @@ public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent) UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void CollectRewards(); void CollectRewards();
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
void CustomBountyAlteringEffect1();
UFUNCTION(BlueprintCallable, Category = "Bounty") // ------------- Custom Bounty Alterations -------------
FString GetCustomBountyAlteringEffect1_Description() UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
{ void BuyCustomBountyAlteration_1();
return CustomAlteringEffect1_Description;
}
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
void CustomBountyAlteringEffect2(); void BuyCustomBountyAlteration_2();
UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteringEffect2_Description()
{
return CustomAlteringEffect2_Description;
}
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty") UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
void CustomBountyAlteringEffect3(); void BuyCustomBountyAlteration_3();
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteringEffect3_Description() FString GetCustomBountyAlteration_1_Description()
{ {
return CustomAlteringEffect3_Description; return CustomBountyAlteration_1_Description;
} }
UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteration_2_Description()
{
return CustomBountyAlteration_2_Description;
}
UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteration_3_Description()
{
return CustomBountyAlteration_3_Description;
}
UFUNCTION(BlueprintCallable, Category = "Bounty")
int GetCustomBountyAlteration_1_Cost()
{
return CustomBountyAlteration_1_Cost;
}
UFUNCTION(BlueprintCallable, Category = "Bounty")
int GetCustomBountyAlteration_2_Cost()
{
return CustomBountyAlteration_2_Cost;
}
UFUNCTION(BlueprintCallable, Category = "Bounty")
int GetCustomBountyAlteration_3_Cost()
{
return CustomBountyAlteration_3_Cost;
}
// ------------- Simple Bounty Alterations -------------
void BuySpawnAmmoDrops();
void BuySpawnHealthDrops();
void BuyEnemyRadio()
{
HasEnemyRadio = true;
}
// Concerned Enemies will call this function, if true, play funny poop voice line and stop enemies from being concerned
bool CheckIfHasEnemyRadio()
{
return HasEnemyRadio;
};
}; };