Merge remote-tracking branch 'origin/dev' into Level-Design
This commit is contained in:
commit
fb0bd09bb2
@ -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
|
||||
|
||||
|
@ -82,6 +82,7 @@ DoubleClickTime=0.200000
|
||||
+ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
|
||||
+ActionMappings=(ActionName="Interact",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=E)
|
||||
+ActionMappings=(ActionName="RightClick",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
|
||||
+ActionMappings=(ActionName="Sneak",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftControl)
|
||||
+AxisMappings=(AxisName="Look Up / Down Gamepad",Scale=1.000000,Key=Gamepad_RightY)
|
||||
+AxisMappings=(AxisName="Look Up / Down Mouse",Scale=-1.000000,Key=MouseY)
|
||||
+AxisMappings=(AxisName="Move Forward / Backward",Scale=1.000000,Key=Gamepad_LeftY)
|
||||
|
BIN
Content/Assets/Objects/Caves/Blue_rocks.uasset
(Stored with Git LFS)
BIN
Content/Assets/Objects/Caves/Blue_rocks.uasset
(Stored with Git LFS)
Binary file not shown.
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/Inventory_UI/WBP_ItemDisplay.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Inventory_UI/WBP_PlayerInventory.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/Merchant/Merchant_UI/BP_OPENDIAL.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.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/Dialogue/DialogueTest.umap
(Stored with Git LFS)
Normal file
BIN
Content/Dialogue/DialogueTest.umap
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Dialogue/NPCTest.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Dialogue/NPCTest.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Dialogue/TextPrompt.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Dialogue/TextPrompt.uasset
(Stored with Git LFS)
Normal file
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/Testing/BreakableWall_BP.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Levels/Testing/BreakableWall_BP.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Levels/Testing/CopyStalagite.uasset
(Stored with Git LFS)
BIN
Content/Levels/Testing/CopyStalagite.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Testing/DestructableEnvironment.umap
(Stored with Git LFS)
BIN
Content/Levels/Testing/DestructableEnvironment.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Testing/Stalagite_GeometryCollection.uasset
(Stored with Git LFS)
BIN
Content/Levels/Testing/Stalagite_GeometryCollection.uasset
(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.
BIN
Content/Particles/Break.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Particles/Break.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -4,3 +4,10 @@ Combat Spread Sheet:
|
||||
https://docs.google.com/spreadsheets/d/1s_uxjS8ir1pbt4-ofdOVpSPaQZVC8x9gQzS78bzE3KI/edit#gid=0
|
||||
https://docs.google.com/document/d/1Y6eYoKQPw9n8gl7p030fmtPjfJcE132YHAvwL7Gk4jk/edit
|
||||
|
||||
Level Blueprints - https://docs.google.com/presentation/d/1ckx8IpO-BIxTFy19MJoUy7EuAMYOYoWQE6x1E2egr1o/edit?usp=sharing
|
||||
|
||||
Art:
|
||||
|
||||
Final Boss Moodboard - https://docs.google.com/presentation/d/1gX9ULwwuVboH_wPwBXa9AMLEhPbUqvfy5N3zeBOL89I/edit?usp=sharing
|
||||
Art examples (Pre-Production) - https://docs.google.com/presentation/d/1Tc7nAdgg7ENsuV-6jGyYGHbYBLcY65losUjOYYhMHWs/edit?usp=sharing
|
||||
Art Examples (Post-Production) - https://docs.google.com/presentation/d/1AEB9NNNOdRZfw2UrT9vZEwUF5QP9rvr0lqPNxoMJWCE/edit?usp=sharing
|
@ -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,26 +16,40 @@ 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);
|
||||
|
||||
}
|
||||
if(isDamageBuffItem == true)
|
||||
else if (Character->Health >= 100)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Health is full"));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
|
118
Source/the_twilight_abyss/Dialogue/DialogueNPC.cpp
Normal file
118
Source/the_twilight_abyss/Dialogue/DialogueNPC.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DialogueNPC.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
// Sets default values for this component's properties
|
||||
UDialogueNPC::UDialogueNPC()
|
||||
{
|
||||
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
|
||||
// off to improve performance if you don't need them.
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
|
||||
static ConstructorHelpers::FClassFinder<UUserWidget> DialogueWidgetClass(TEXT("/Game/Dialogue/TextPrompt"));
|
||||
DialogueWidget = DialogueWidgetClass.Class;
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts
|
||||
void UDialogueNPC::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
DialogueWidgetInstance = CreateWidget<UUserWidget>(GetWorld(), DialogueWidget);
|
||||
|
||||
NPCNameText = Cast<UTextBlock>(DialogueWidgetInstance->GetWidgetFromName("Text_Name"));
|
||||
DialogueText = Cast<UTextBlock>(DialogueWidgetInstance->GetWidgetFromName("Text_Dialogue"));
|
||||
NextButton = Cast<UButton>(DialogueWidgetInstance->GetWidgetFromName("Button_Next"));
|
||||
NextButton->OnClicked.AddDynamic(this, &UDialogueNPC::NextDialogue);
|
||||
}
|
||||
|
||||
|
||||
void UDialogueNPC::NextDialogue()
|
||||
{
|
||||
//Dialogue Skip
|
||||
if (CurrentDialogue.Len() < Dialogue[DialogueIndex].Len())
|
||||
{
|
||||
CurrentDialogue = Dialogue[DialogueIndex];
|
||||
DialogueText->SetText(FText::FromString(CurrentDialogue));
|
||||
return;
|
||||
}
|
||||
|
||||
DialogueIndex++;
|
||||
if (DialogueIndex >= Dialogue.Num())
|
||||
{
|
||||
EndDialogue();
|
||||
return;
|
||||
}
|
||||
CurrentDialogue = "";
|
||||
}
|
||||
|
||||
void UDialogueNPC::NextCharacter()
|
||||
{
|
||||
if (DialogueIndex >= Dialogue.Num()) return;
|
||||
|
||||
if (CurrentDialogue.Len() < Dialogue[DialogueIndex].Len())
|
||||
{
|
||||
CurrentDialogue.AppendChar(Dialogue[DialogueIndex][CurrentDialogue.Len()]);
|
||||
DialogueText->SetText(FText::FromString(CurrentDialogue));
|
||||
}
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void UDialogueNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
void UDialogueNPC::StartDialogue()
|
||||
{
|
||||
//Disable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
//Set to UI Mode Only
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeUIOnly());
|
||||
PlayerController->bShowMouseCursor = true;
|
||||
|
||||
DialogueWidgetInstance->AddToViewport();
|
||||
DialogueIndex = 1;
|
||||
NPCNameText->SetText(FText::FromString(NPCName));
|
||||
CurrentDialogue = "";
|
||||
GetWorld()->GetTimerManager().SetTimer(TextAnimationTimerHandle, this, &UDialogueNPC::NextCharacter, TextAnimationSpeed, true);
|
||||
}
|
||||
|
||||
void UDialogueNPC::EndDialogue()
|
||||
{
|
||||
TextAnimationTimerHandle.Invalidate();
|
||||
DialogueWidgetInstance->RemoveFromParent();
|
||||
|
||||
//Enable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
//Reset UI Mode
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeGameOnly());
|
||||
PlayerController->bShowMouseCursor = false;
|
||||
}
|
||||
|
||||
TArray<FString> UDialogueNPC::AddDialogue(FText TextInput, TArray<FString> DialogueArrayInput)
|
||||
{
|
||||
if (TextInput.IsEmpty()) return DialogueArrayInput;
|
||||
DialogueArrayInput.Add(TextInput.ToString());
|
||||
return DialogueArrayInput;
|
||||
}
|
||||
|
||||
void UDialogueNPC::GetFinalDialogue(TArray<FString> DialogueArray)
|
||||
{
|
||||
Dialogue = DialogueArray;
|
||||
}
|
82
Source/the_twilight_abyss/Dialogue/DialogueNPC.h
Normal file
82
Source/the_twilight_abyss/Dialogue/DialogueNPC.h
Normal file
@ -0,0 +1,82 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "Components/Button.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "DialogueNPC.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EChoices : uint8
|
||||
{
|
||||
Choice1 UMETA(DisplayName="Choice 1"),
|
||||
Choice2 UMETA(DisplayName="Choice 2"),
|
||||
Choice3 UMETA(DisplayName="Choice 3"),
|
||||
};
|
||||
|
||||
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
||||
class THE_TWILIGHT_ABYSS_API UDialogueNPC : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UDialogueNPC();
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
FString NPCName;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<FString> Dialogue;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
float TextAnimationSpeed = 0.05f;
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
UPROPERTY()
|
||||
TSubclassOf<UUserWidget> DialogueWidget;
|
||||
|
||||
private:
|
||||
UPROPERTY()
|
||||
UUserWidget* DialogueWidgetInstance;
|
||||
|
||||
UPROPERTY()
|
||||
UTextBlock* NPCNameText;
|
||||
|
||||
UPROPERTY()
|
||||
UTextBlock* DialogueText;
|
||||
|
||||
UPROPERTY()
|
||||
UButton* NextButton;
|
||||
|
||||
int DialogueIndex = 1;
|
||||
FString CurrentDialogue;
|
||||
|
||||
UPROPERTY()
|
||||
FTimerHandle TextAnimationTimerHandle;
|
||||
|
||||
UFUNCTION()
|
||||
void NextDialogue();
|
||||
void NextCharacter();
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void StartDialogue();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void EndDialogue();
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
TArray<FString> AddDialogue(FText TextInput, TArray<FString> DialogueArrayInput);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void GetFinalDialogue(TArray<FString> DialogueArray);
|
||||
};
|
54
Source/the_twilight_abyss/Dialogue/InteractNPC.cpp
Normal file
54
Source/the_twilight_abyss/Dialogue/InteractNPC.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "InteractNPC.h"
|
||||
#include "DialogueNPC.h"
|
||||
|
||||
|
||||
// Sets default values for this component's properties
|
||||
UInteractNPC::UInteractNPC()
|
||||
{
|
||||
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
|
||||
// off to improve performance if you don't need them.
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts
|
||||
void UInteractNPC::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
// ...
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called every frame
|
||||
void UInteractNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
void UInteractNPC::Interact()
|
||||
{
|
||||
FVector Start = GetOwner()->GetActorLocation();
|
||||
FVector End = GetOwner()->GetActorForwardVector() * 100.0f + Start;
|
||||
FCollisionQueryParams CollisionParams;
|
||||
CollisionParams.AddIgnoredActor(GetOwner());
|
||||
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams))
|
||||
{
|
||||
//UE_LOG(LogTemp, Warning, TEXT("Hit: %s"), *HitResult.GetActor()->GetName());
|
||||
if (HitResult.GetActor()->Tags.Contains("NPC"))
|
||||
{
|
||||
//DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f);
|
||||
HitResult.GetActor()->FindComponentByClass<UDialogueNPC>()->StartDialogue();
|
||||
}
|
||||
//DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f);
|
||||
}
|
||||
}
|
||||
|
29
Source/the_twilight_abyss/Dialogue/InteractNPC.h
Normal file
29
Source/the_twilight_abyss/Dialogue/InteractNPC.h
Normal file
@ -0,0 +1,29 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "InteractNPC.generated.h"
|
||||
|
||||
|
||||
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
||||
class THE_TWILIGHT_ABYSS_API UInteractNPC : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UInteractNPC();
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void Interact();
|
||||
};
|
@ -5,7 +5,11 @@
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "the_twilight_abyss/BaseItems/InventoryComponent.h"
|
||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.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
|
||||
@ -17,6 +21,8 @@ ATempCharacter::ATempCharacter()
|
||||
Inventory->MaxItemSlots = 10;
|
||||
GoldBalance = GoldBalance;
|
||||
Health = Health;
|
||||
this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
@ -24,17 +30,61 @@ void ATempCharacter::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
Health = 100;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
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
|
||||
void ATempCharacter::ForwardInput(float Axis)
|
||||
{
|
||||
AddMovementInput(GetActorForwardVector() * Axis);
|
||||
AddMovementInput(UKismetMathLibrary::GetForwardVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis);
|
||||
}
|
||||
//Binds the input we made in the setup player component to the right vector
|
||||
void ATempCharacter::RightMoveInput(float Axis)
|
||||
{
|
||||
AddMovementInput(GetActorRightVector() * Axis);
|
||||
AddMovementInput(UKismetMathLibrary::GetRightVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis);
|
||||
}
|
||||
|
||||
void ATempCharacter::Sneak()
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Sneak activated"));
|
||||
if (bIsCrouched)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +102,9 @@ void ATempCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCompo
|
||||
PlayerInputComponent->BindAxis(TEXT("Move Right / Left"), this, &ATempCharacter::RightMoveInput);
|
||||
PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput);
|
||||
PlayerInputComponent->BindAxis(TEXT("Look Up / Down Mouse"), this, &ATempCharacter::AddControllerPitchInput);
|
||||
PlayerInputComponent->BindAction(TEXT("Jump"), IE_Pressed, this, &ATempCharacter::Jump);
|
||||
PlayerInputComponent->BindAction(TEXT("Sneak"), IE_Pressed, this, &ATempCharacter::Sneak);
|
||||
PlayerInputComponent->BindAction(TEXT("Sneak"), IE_Released, this, &ATempCharacter::Sneak);
|
||||
PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
|
||||
}
|
||||
|
||||
@ -61,6 +114,8 @@ void ATempCharacter::KeyPressed()
|
||||
LineTraceLogic();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Line trace logic
|
||||
void ATempCharacter::LineTraceLogic()
|
||||
{
|
||||
@ -85,6 +140,7 @@ void ATempCharacter::LineTraceLogic()
|
||||
}
|
||||
if(OutHit.GetActor()->FindComponentByClass<UInventoryComponent>())
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
|
||||
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
|
||||
if(GoldBalance >= ItemArray->ItemCostPrice)
|
||||
{
|
||||
@ -96,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
|
||||
|
||||
@ -138,49 +198,46 @@ void ATempCharacter::LineTraceLogic()
|
||||
|
||||
void ATempCharacter::InputDisabler()
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Disabling playermovement"));
|
||||
//GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed);
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true);
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true);
|
||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = true;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = true;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
if (ThisCamera == nullptr)
|
||||
//Disable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
return;
|
||||
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
else
|
||||
//Set to UI Mode Only
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeUIOnly());
|
||||
PlayerController->bShowMouseCursor = true;
|
||||
|
||||
disableTab = true;
|
||||
if (ThisCamera != nullptr)
|
||||
{
|
||||
OriginalCameraLocation = ThisCamera->GetComponentLocation();
|
||||
OriginalCameraRotation = ThisCamera->GetComponentRotation();
|
||||
OriginalCameraFOV = ThisCamera->FieldOfView;
|
||||
//ulog the originalcameralocation value
|
||||
UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
void ATempCharacter::InputEnabler()
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false);
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false);
|
||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
|
||||
//GetWorld()->GetFirstPlayerController()->InputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
|
||||
TraceDistance = 300;
|
||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||
if (ThisCamera == nullptr)
|
||||
//Enable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
return;
|
||||
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
else
|
||||
//Reset UI Mode
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeGameOnly());
|
||||
PlayerController->bShowMouseCursor = false;
|
||||
|
||||
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
|
||||
disableTab = true;
|
||||
TraceDistance = 300;
|
||||
if (ThisCamera != nullptr)
|
||||
{
|
||||
ThisCamera->SetWorldLocation(OriginalCameraLocation);
|
||||
ThisCamera->SetWorldRotation(OriginalCameraRotation);
|
||||
ThisCamera->FieldOfView = OriginalCameraFOV;
|
||||
//ulog the originalcameralocation value
|
||||
UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
|
||||
}
|
||||
}
|
||||
@ -190,7 +247,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
|
||||
if(Item)
|
||||
{
|
||||
Item->Use(this);
|
||||
Item->OnUse(this); //Blueprint Version
|
||||
Item->OnUse(this); //OnUse is a Blueprint Version
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#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"
|
||||
|
||||
UCLASS()
|
||||
@ -25,6 +25,12 @@ protected:
|
||||
void ForwardInput(float Axis);
|
||||
void RightMoveInput(float Axis);
|
||||
|
||||
UFUNCTION()
|
||||
void Sneak();
|
||||
|
||||
|
||||
UCapsuleComponent* PlayerCapsule;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
@ -78,4 +84,15 @@ public:
|
||||
|
||||
bool bShopKeeperText = false;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool disableTab = false;
|
||||
|
||||
APostProcessVolume* PostProcessVolume;
|
||||
|
||||
TArray <AActor*> AIActors;
|
||||
|
||||
FName Enemy;
|
||||
|
||||
FName Ammo;
|
||||
|
||||
};
|
||||
|
@ -42,17 +42,16 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
||||
IronResource = 10;
|
||||
SulfurResource = 10;
|
||||
|
||||
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController()))
|
||||
{
|
||||
PC->bShowMouseCursor = true;
|
||||
PC->bEnableClickEvents = true;
|
||||
PC->bEnableMouseOverEvents = true;
|
||||
}
|
||||
//Disable Character Movement
|
||||
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||
{
|
||||
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
//Set to UI Mode Only
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeUIOnly());
|
||||
PlayerController->bShowMouseCursor = true;
|
||||
|
||||
CurrentComboString = "";
|
||||
UpdateComboString(CurrentComboString);
|
||||
RevertActionPoints();
|
||||
@ -73,17 +72,10 @@ void ATurnBaseCombatV2::EndCombat()
|
||||
{
|
||||
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
|
||||
}
|
||||
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController()))
|
||||
{
|
||||
PC->bShowMouseCursor = false;
|
||||
PC->bEnableClickEvents = false;
|
||||
PC->bEnableMouseOverEvents = false;
|
||||
}
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false);
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false);
|
||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
|
||||
//Set to Game Mode Only
|
||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||
PlayerController->SetInputMode(FInputModeGameOnly());
|
||||
PlayerController->bShowMouseCursor = false;
|
||||
}
|
||||
|
||||
void ATurnBaseCombatV2::FKeyPressed()
|
||||
|
Loading…
Reference in New Issue
Block a user