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
|
||||
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->World = GetWorld();
|
||||
bool isNewItem = true;
|
||||
// for every item in inventory
|
||||
for (auto & Item : Items)
|
||||
{
|
||||
//if the item is the same as the item that is being added
|
||||
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++;
|
||||
UE_LOG(LogTemp, Display, TEXT("ITEM STACKCOUNT: %d"), Item->StackCount);
|
||||
isNewItem = false;
|
||||
|
@ -14,3 +14,4 @@ void UBaseItem::Use(ATempCharacter* Character)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,9 @@ public:
|
||||
UPROPERTY(EditAnywhere, Category = "Item")
|
||||
bool isDamageBuffItem;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Item")
|
||||
bool isAmmoItemType;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
|
||||
int32 StackCount = 1;
|
||||
|
||||
@ -69,4 +72,5 @@ public:
|
||||
//This is the same as the use item class but its in BP instead
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void OnUse(class ATempCharacter* Character);
|
||||
|
||||
};
|
||||
|
@ -16,13 +16,12 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
{
|
||||
if(Character)
|
||||
{
|
||||
if(isHealingItem == true)
|
||||
if(isHealingItem)
|
||||
{
|
||||
if (Character->Health < 100)
|
||||
{
|
||||
Character->Health += 10;
|
||||
UE_LOG(LogTemp, Display, TEXT("Healed"));
|
||||
//delete itself
|
||||
Character->Inventory->RemoveItem(this);
|
||||
}
|
||||
else if (Character->Health >= 100)
|
||||
@ -30,18 +29,27 @@ void UEatableItems::Use(ATempCharacter* Character)
|
||||
UE_LOG(LogTemp, Display, TEXT("Health is full"));
|
||||
}
|
||||
}
|
||||
if(isDamageBuffItem == true)
|
||||
|
||||
if(isDamageBuffItem)
|
||||
{
|
||||
// need to add the damage buff functionality here
|
||||
UE_LOG(LogTemp, Display, TEXT("Damage Buffed"));
|
||||
Character->Inventory->RemoveItem(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
when player uses the item syrengine to debuff enemies
|
||||
detect what enemie actors the player is fighting with
|
||||
lower their damage by a value.
|
||||
*/
|
||||
if (isAmmoItemType)
|
||||
{
|
||||
TurnBaseCombat = GetWorld()->GetGameState<ATurnBaseCombatV2>();
|
||||
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 "BaseItem.h"
|
||||
#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||
#include "EatableItems.generated.h"
|
||||
|
||||
/**
|
||||
@ -19,4 +20,9 @@ class THE_TWILIGHT_ABYSS_API UEatableItems : public UBaseItem
|
||||
protected:
|
||||
|
||||
virtual void Use(class ATempCharacter* Character) override;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
ATurnBaseCombatV2* TurnBaseCombat;
|
||||
};
|
||||
|
@ -5,10 +5,11 @@
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "the_twilight_abyss/BaseItems/InventoryComponent.h"
|
||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "the_twilight_abyss/MerchantInteraction/Interaction.h"
|
||||
#include <Runtime/Engine/Classes/Kismet/GameplayStatics.h>
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
|
||||
|
||||
// CONSTRUCTOR
|
||||
@ -33,8 +34,14 @@ void ATempCharacter::BeginPlay()
|
||||
PlayerCapsule = GetCapsuleComponent();
|
||||
TArray<AActor*> AllActorsInScene;
|
||||
|
||||
//MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH
|
||||
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene);
|
||||
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
|
||||
@ -55,10 +62,26 @@ void ATempCharacter::Sneak()
|
||||
{
|
||||
UnCrouch();
|
||||
PostProcessVolume->Settings.VignetteIntensity = 0.0f;
|
||||
for (AActor* Actor : AIActors)
|
||||
{
|
||||
USphereComponent* SphereComponent = Actor->FindComponentByClass<USphereComponent>();
|
||||
if (SphereComponent != nullptr)
|
||||
{
|
||||
SphereComponent->SetSphereRadius(40.0f); //default value
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Crouch();
|
||||
for (AActor* Actor : AIActors)
|
||||
{
|
||||
USphereComponent* SphereComponent = Actor->FindComponentByClass<USphereComponent>();
|
||||
if (SphereComponent != nullptr)
|
||||
{
|
||||
SphereComponent->SetSphereRadius(15.0f);
|
||||
}
|
||||
}
|
||||
PostProcessVolume->Settings.VignetteIntensity = 0.8f;
|
||||
}
|
||||
|
||||
@ -129,6 +152,10 @@ void ATempCharacter::LineTraceLogic()
|
||||
{
|
||||
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
|
||||
|
||||
@ -182,11 +209,7 @@ void ATempCharacter::InputDisabler()
|
||||
PlayerController->bShowMouseCursor = true;
|
||||
|
||||
disableTab = true;
|
||||
if (ThisCamera == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (ThisCamera != nullptr)
|
||||
{
|
||||
OriginalCameraLocation = ThisCamera->GetComponentLocation();
|
||||
OriginalCameraRotation = ThisCamera->GetComponentRotation();
|
||||
@ -210,11 +233,7 @@ void ATempCharacter::InputEnabler()
|
||||
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
|
||||
disableTab = true;
|
||||
TraceDistance = 300;
|
||||
if (ThisCamera == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (ThisCamera != nullptr)
|
||||
{
|
||||
ThisCamera->SetWorldLocation(OriginalCameraLocation);
|
||||
ThisCamera->SetWorldRotation(OriginalCameraRotation);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "GameFramework/Character.h"
|
||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Engine/PostProcessVolume.h"
|
||||
#include "TempCharacter.generated.h"
|
||||
|
||||
@ -89,4 +88,11 @@ public:
|
||||
bool disableTab = false;
|
||||
|
||||
APostProcessVolume* PostProcessVolume;
|
||||
|
||||
TArray <AActor*> AIActors;
|
||||
|
||||
FName Enemy;
|
||||
|
||||
FName Ammo;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user