Merge pull request #8 from Games-Academy-Student-Work-22-23/resource-mining
Resource mining
This commit is contained in:
commit
cc8eee9727
@ -128,3 +128,15 @@ CompressionQualityModifier=1.000000
|
|||||||
AutoStreamingThreshold=0.000000
|
AutoStreamingThreshold=0.000000
|
||||||
SoundCueCookQualityIndex=-1
|
SoundCueCookQualityIndex=-1
|
||||||
|
|
||||||
|
[/Script/GameplayDebugger.GameplayDebuggerConfig]
|
||||||
|
CategorySlot1=One
|
||||||
|
CategorySlot2=Two
|
||||||
|
CategorySlot3=Three
|
||||||
|
CategorySlot4=Four
|
||||||
|
CategorySlot5=Five
|
||||||
|
CategorySlot6=Six
|
||||||
|
CategorySlot7=Seven
|
||||||
|
CategorySlot8=Eight
|
||||||
|
CategorySlot9=Nine
|
||||||
|
CategorySlot0=Zero
|
||||||
|
|
||||||
|
BIN
Content/Blueprints/Combat_UI/CombatCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/CombatCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Items/AmmoItem.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/Items/AmmoItem.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Player/BP_MyTempCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Player/BP_MyTempCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Images/ammoicon.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Images/ammoicon.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Levels/MerchantPrototype.umap
(Stored with Git LFS)
BIN
Content/Levels/MerchantPrototype.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Top_layer_level.umap
(Stored with Git LFS)
BIN
Content/Levels/Top_layer_level.umap
(Stored with Git LFS)
Binary file not shown.
@ -40,13 +40,11 @@ bool UInventoryComponent::AddItem(class UBaseItem* BaseItem)
|
|||||||
BaseItem->StoredItems = this;
|
BaseItem->StoredItems = this;
|
||||||
BaseItem->World = GetWorld();
|
BaseItem->World = GetWorld();
|
||||||
bool isNewItem = true;
|
bool isNewItem = true;
|
||||||
// for every item in inventory
|
|
||||||
for (auto & Item : Items)
|
for (auto & Item : Items)
|
||||||
{
|
{
|
||||||
//if the item is the same as the item that is being added
|
//if the item is the same as the item that is being added
|
||||||
if (Item->ItemDisplayName.ToString() == BaseItem->ItemDisplayName.ToString())
|
if (Item->ItemDisplayName.ToString() == BaseItem->ItemDisplayName.ToString())
|
||||||
{
|
{
|
||||||
//add the amount of the item that is being added to the item in the inventory
|
|
||||||
Item->StackCount++;
|
Item->StackCount++;
|
||||||
UE_LOG(LogTemp, Display, TEXT("ITEM STACKCOUNT: %d"), Item->StackCount);
|
UE_LOG(LogTemp, Display, TEXT("ITEM STACKCOUNT: %d"), Item->StackCount);
|
||||||
isNewItem = false;
|
isNewItem = false;
|
||||||
|
@ -14,3 +14,4 @@ void UBaseItem::Use(ATempCharacter* Character)
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,9 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, Category = "Item")
|
UPROPERTY(EditAnywhere, Category = "Item")
|
||||||
bool isDamageBuffItem;
|
bool isDamageBuffItem;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Item")
|
||||||
|
bool isAmmoItemType;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
|
||||||
int32 StackCount = 1;
|
int32 StackCount = 1;
|
||||||
|
|
||||||
@ -69,4 +72,5 @@ public:
|
|||||||
//This is the same as the use item class but its in BP instead
|
//This is the same as the use item class but its in BP instead
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void OnUse(class ATempCharacter* Character);
|
void OnUse(class ATempCharacter* Character);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -16,13 +16,12 @@ void UEatableItems::Use(ATempCharacter* Character)
|
|||||||
{
|
{
|
||||||
if(Character)
|
if(Character)
|
||||||
{
|
{
|
||||||
if(isHealingItem == true)
|
if(isHealingItem)
|
||||||
{
|
{
|
||||||
if (Character->Health < 100)
|
if (Character->Health < 100)
|
||||||
{
|
{
|
||||||
Character->Health += 10;
|
Character->Health += 10;
|
||||||
UE_LOG(LogTemp, Display, TEXT("Healed"));
|
UE_LOG(LogTemp, Display, TEXT("Healed"));
|
||||||
//delete itself
|
|
||||||
Character->Inventory->RemoveItem(this);
|
Character->Inventory->RemoveItem(this);
|
||||||
}
|
}
|
||||||
else if (Character->Health >= 100)
|
else if (Character->Health >= 100)
|
||||||
@ -30,18 +29,27 @@ void UEatableItems::Use(ATempCharacter* Character)
|
|||||||
UE_LOG(LogTemp, Display, TEXT("Health is full"));
|
UE_LOG(LogTemp, Display, TEXT("Health is full"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isDamageBuffItem == true)
|
|
||||||
|
if(isDamageBuffItem)
|
||||||
{
|
{
|
||||||
// need to add the damage buff functionality here
|
// need to add the damage buff functionality here
|
||||||
UE_LOG(LogTemp, Display, TEXT("Damage Buffed"));
|
UE_LOG(LogTemp, Display, TEXT("Damage Buffed"));
|
||||||
Character->Inventory->RemoveItem(this);
|
Character->Inventory->RemoveItem(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (isAmmoItemType)
|
||||||
when player uses the item syrengine to debuff enemies
|
{
|
||||||
detect what enemie actors the player is fighting with
|
TurnBaseCombat = GetWorld()->GetGameState<ATurnBaseCombatV2>();
|
||||||
lower their damage by a value.
|
if (TurnBaseCombat->IronResource > 10)
|
||||||
*/
|
{
|
||||||
|
TurnBaseCombat->IronResource += 5;
|
||||||
|
}
|
||||||
|
if (TurnBaseCombat->SulfurResource > 10)
|
||||||
|
{
|
||||||
|
TurnBaseCombat->SulfurResource += 5;
|
||||||
|
}
|
||||||
|
Character->Inventory->RemoveItem(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "BaseItem.h"
|
#include "BaseItem.h"
|
||||||
|
#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||||
#include "EatableItems.generated.h"
|
#include "EatableItems.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,4 +20,9 @@ class THE_TWILIGHT_ABYSS_API UEatableItems : public UBaseItem
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void Use(class ATempCharacter* Character) override;
|
virtual void Use(class ATempCharacter* Character) override;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ATurnBaseCombatV2* TurnBaseCombat;
|
||||||
};
|
};
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "the_twilight_abyss/BaseItems/InventoryComponent.h"
|
#include "the_twilight_abyss/BaseItems/InventoryComponent.h"
|
||||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
||||||
#include "Components/CapsuleComponent.h"
|
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "the_twilight_abyss/MerchantInteraction/Interaction.h"
|
#include "the_twilight_abyss/MerchantInteraction/Interaction.h"
|
||||||
#include <Runtime/Engine/Classes/Kismet/GameplayStatics.h>
|
#include <Runtime/Engine/Classes/Kismet/GameplayStatics.h>
|
||||||
|
#include "Components/SphereComponent.h"
|
||||||
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
|
|
||||||
|
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
@ -33,8 +34,14 @@ void ATempCharacter::BeginPlay()
|
|||||||
PlayerCapsule = GetCapsuleComponent();
|
PlayerCapsule = GetCapsuleComponent();
|
||||||
TArray<AActor*> AllActorsInScene;
|
TArray<AActor*> AllActorsInScene;
|
||||||
|
|
||||||
|
//MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH
|
||||||
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene);
|
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene);
|
||||||
PostProcessVolume = Cast<APostProcessVolume>(AllActorsInScene[0]);
|
PostProcessVolume = Cast<APostProcessVolume>(AllActorsInScene[0]);
|
||||||
|
|
||||||
|
Enemy = TEXT("Enemy");
|
||||||
|
UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors);
|
||||||
|
|
||||||
|
Ammo = TEXT("Ammo");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Binds the input we made in the setup player component to the forward vector
|
//Binds the input we made in the setup player component to the forward vector
|
||||||
@ -55,10 +62,26 @@ void ATempCharacter::Sneak()
|
|||||||
{
|
{
|
||||||
UnCrouch();
|
UnCrouch();
|
||||||
PostProcessVolume->Settings.VignetteIntensity = 0.0f;
|
PostProcessVolume->Settings.VignetteIntensity = 0.0f;
|
||||||
|
for (AActor* Actor : AIActors)
|
||||||
|
{
|
||||||
|
USphereComponent* SphereComponent = Actor->FindComponentByClass<USphereComponent>();
|
||||||
|
if (SphereComponent != nullptr)
|
||||||
|
{
|
||||||
|
SphereComponent->SetSphereRadius(40.0f); //default value
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Crouch();
|
Crouch();
|
||||||
|
for (AActor* Actor : AIActors)
|
||||||
|
{
|
||||||
|
USphereComponent* SphereComponent = Actor->FindComponentByClass<USphereComponent>();
|
||||||
|
if (SphereComponent != nullptr)
|
||||||
|
{
|
||||||
|
SphereComponent->SetSphereRadius(15.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
PostProcessVolume->Settings.VignetteIntensity = 0.8f;
|
PostProcessVolume->Settings.VignetteIntensity = 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +152,10 @@ void ATempCharacter::LineTraceLogic()
|
|||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Display, TEXT("Not Enough Gold"));
|
UE_LOG(LogTemp, Display, TEXT("Not Enough Gold"));
|
||||||
}
|
}
|
||||||
|
if(OutHit.GetActor()->ActorHasTag(Ammo))
|
||||||
|
{
|
||||||
|
OutHit.GetActor()->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if the actor hit has the interaction component/script then it will activate the code
|
// if the actor hit has the interaction component/script then it will activate the code
|
||||||
|
|
||||||
@ -182,11 +209,7 @@ void ATempCharacter::InputDisabler()
|
|||||||
PlayerController->bShowMouseCursor = true;
|
PlayerController->bShowMouseCursor = true;
|
||||||
|
|
||||||
disableTab = true;
|
disableTab = true;
|
||||||
if (ThisCamera == nullptr)
|
if (ThisCamera != nullptr)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
OriginalCameraLocation = ThisCamera->GetComponentLocation();
|
OriginalCameraLocation = ThisCamera->GetComponentLocation();
|
||||||
OriginalCameraRotation = ThisCamera->GetComponentRotation();
|
OriginalCameraRotation = ThisCamera->GetComponentRotation();
|
||||||
@ -210,11 +233,7 @@ void ATempCharacter::InputEnabler()
|
|||||||
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
|
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
|
||||||
disableTab = true;
|
disableTab = true;
|
||||||
TraceDistance = 300;
|
TraceDistance = 300;
|
||||||
if (ThisCamera == nullptr)
|
if (ThisCamera != nullptr)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ThisCamera->SetWorldLocation(OriginalCameraLocation);
|
ThisCamera->SetWorldLocation(OriginalCameraLocation);
|
||||||
ThisCamera->SetWorldRotation(OriginalCameraRotation);
|
ThisCamera->SetWorldRotation(OriginalCameraRotation);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "Kismet/KismetMathLibrary.h"
|
|
||||||
#include "Engine/PostProcessVolume.h"
|
#include "Engine/PostProcessVolume.h"
|
||||||
#include "TempCharacter.generated.h"
|
#include "TempCharacter.generated.h"
|
||||||
|
|
||||||
@ -89,4 +88,11 @@ public:
|
|||||||
bool disableTab = false;
|
bool disableTab = false;
|
||||||
|
|
||||||
APostProcessVolume* PostProcessVolume;
|
APostProcessVolume* PostProcessVolume;
|
||||||
|
|
||||||
|
TArray <AActor*> AIActors;
|
||||||
|
|
||||||
|
FName Enemy;
|
||||||
|
|
||||||
|
FName Ammo;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user