Updates
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "NakedDesire/MissionBuilder/MissionsConfig.h"
|
||||
#include "NakedDesire/MissionBuilder/MissionsManager.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
|
||||
void ANakedDesireGameMode::RestartGame()
|
||||
{
|
||||
@@ -22,18 +23,19 @@ AWardrobe* ANakedDesireGameMode::GetWardrobe() const
|
||||
|
||||
void ANakedDesireGameMode::BuyItem(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
ANakedDesireCharacter* Player = Cast<ANakedDesireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
|
||||
if (!Player)
|
||||
UGlobalSaveGameData* SaveGame = UGlobalSaveGameData::LoadGame();
|
||||
if (!SaveGame)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("ANakedDesireGameMode::BuyItem Couldn't load save game"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (SaveGame->Money < ClothingItemInstance->GetClothingItem()->BasePrice)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player->Money < ClothingItemInstance->GetClothingItem()->BasePrice)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player->Money -= ClothingItemInstance->GetClothingItem()->BasePrice;
|
||||
SaveGame->Money -= ClothingItemInstance->GetClothingItem()->BasePrice;
|
||||
Wardrobe->ClothingItems.Add(ClothingItemInstance);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user