Merge remote-tracking branch 'origin/dev' into Level-Design

This commit is contained in:
Philip W 2023-02-23 15:06:57 +00:00
commit fb0bd09bb2
38 changed files with 504 additions and 94 deletions

View File

@ -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

View File

@ -82,6 +82,7 @@ DoubleClickTime=0.200000
+ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar) +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="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="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 Gamepad",Scale=1.000000,Key=Gamepad_RightY)
+AxisMappings=(AxisName="Look Up / Down Mouse",Scale=-1.000000,Key=MouseY) +AxisMappings=(AxisName="Look Up / Down Mouse",Scale=-1.000000,Key=MouseY)
+AxisMappings=(AxisName="Move Forward / Backward",Scale=1.000000,Key=Gamepad_LeftY) +AxisMappings=(AxisName="Move Forward / Backward",Scale=1.000000,Key=Gamepad_LeftY)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

View File

@ -4,3 +4,10 @@ Combat Spread Sheet:
https://docs.google.com/spreadsheets/d/1s_uxjS8ir1pbt4-ofdOVpSPaQZVC8x9gQzS78bzE3KI/edit#gid=0 https://docs.google.com/spreadsheets/d/1s_uxjS8ir1pbt4-ofdOVpSPaQZVC8x9gQzS78bzE3KI/edit#gid=0
https://docs.google.com/document/d/1Y6eYoKQPw9n8gl7p030fmtPjfJcE132YHAvwL7Gk4jk/edit 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

View File

@ -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;

View File

@ -14,3 +14,4 @@ void UBaseItem::Use(ATempCharacter* Character)
{ {
} }

View File

@ -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);
}; };

View File

@ -16,26 +16,40 @@ void UEatableItems::Use(ATempCharacter* Character)
{ {
if(Character) if(Character)
{ {
if(isHealingItem == true) if(isHealingItem)
{ {
Character->Health += 10; if (Character->Health < 100)
UE_LOG(LogTemp, Display, TEXT("Healed")); {
//delete itself Character->Health += 10;
Character->Inventory->RemoveItem(this); UE_LOG(LogTemp, Display, TEXT("Healed"));
Character->Inventory->RemoveItem(this);
}
else if (Character->Health >= 100)
{
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);
}
}
} }

View File

@ -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;
}; };

View 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;
}

View 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);
};

View 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);
}
}

View 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();
};

View File

@ -5,7 +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 "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 "Components/SphereComponent.h"
#include "Kismet/KismetMathLibrary.h"
// CONSTRUCTOR // CONSTRUCTOR
@ -17,6 +21,8 @@ ATempCharacter::ATempCharacter()
Inventory->MaxItemSlots = 10; Inventory->MaxItemSlots = 10;
GoldBalance = GoldBalance; GoldBalance = GoldBalance;
Health = Health; Health = Health;
this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
} }
// Called when the game starts or when spawned // Called when the game starts or when spawned
@ -24,17 +30,61 @@ void ATempCharacter::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
Health = 100; 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 //Binds the input we made in the setup player component to the forward vector
void ATempCharacter::ForwardInput(float Axis) 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 //Binds the input we made in the setup player component to the right vector
void ATempCharacter::RightMoveInput(float Axis) 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("Move Right / Left"), this, &ATempCharacter::RightMoveInput);
PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput); PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput);
PlayerInputComponent->BindAxis(TEXT("Look Up / Down Mouse"), this, &ATempCharacter::AddControllerPitchInput); 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); PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
} }
@ -61,6 +114,8 @@ void ATempCharacter::KeyPressed()
LineTraceLogic(); LineTraceLogic();
} }
// Line trace logic // Line trace logic
void ATempCharacter::LineTraceLogic() void ATempCharacter::LineTraceLogic()
{ {
@ -85,6 +140,7 @@ void ATempCharacter::LineTraceLogic()
} }
if(OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()) if(OutHit.GetActor()->FindComponentByClass<UInventoryComponent>())
{ {
UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0); auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if(GoldBalance >= ItemArray->ItemCostPrice) if(GoldBalance >= ItemArray->ItemCostPrice)
{ {
@ -96,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
@ -138,49 +198,46 @@ void ATempCharacter::LineTraceLogic()
void ATempCharacter::InputDisabler() void ATempCharacter::InputDisabler()
{ {
UE_LOG(LogTemp, Display, TEXT("Disabling playermovement")); //Disable Character Movement
//GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed); if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
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)
{ {
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(); OriginalCameraLocation = ThisCamera->GetComponentLocation();
OriginalCameraRotation = ThisCamera->GetComponentRotation(); OriginalCameraRotation = ThisCamera->GetComponentRotation();
OriginalCameraFOV = ThisCamera->FieldOfView; OriginalCameraFOV = ThisCamera->FieldOfView;
//ulog the originalcameralocation value
UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString()); UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
} }
} }
void ATempCharacter::InputEnabler() void ATempCharacter::InputEnabler()
{ {
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); //Enable Character Movement
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false); if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
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)
{ {
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->SetWorldLocation(OriginalCameraLocation);
ThisCamera->SetWorldRotation(OriginalCameraRotation); ThisCamera->SetWorldRotation(OriginalCameraRotation);
ThisCamera->FieldOfView = OriginalCameraFOV; ThisCamera->FieldOfView = OriginalCameraFOV;
//ulog the originalcameralocation value
UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString()); UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString());
} }
} }
@ -190,7 +247,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
if(Item) if(Item)
{ {
Item->Use(this); Item->Use(this);
Item->OnUse(this); //Blueprint Version Item->OnUse(this); //OnUse is a Blueprint Version
} }
} }

View File

@ -6,7 +6,7 @@
#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 "TempCharacter.generated.h" #include "TempCharacter.generated.h"
UCLASS() UCLASS()
@ -25,6 +25,12 @@ protected:
void ForwardInput(float Axis); void ForwardInput(float Axis);
void RightMoveInput(float Axis); void RightMoveInput(float Axis);
UFUNCTION()
void Sneak();
UCapsuleComponent* PlayerCapsule;
public: public:
// Called every frame // Called every frame
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
@ -78,4 +84,15 @@ public:
bool bShopKeeperText = false; bool bShopKeeperText = false;
UPROPERTY(BlueprintReadWrite)
bool disableTab = false;
APostProcessVolume* PostProcessVolume;
TArray <AActor*> AIActors;
FName Enemy;
FName Ammo;
}; };

View File

@ -42,17 +42,16 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
IronResource = 10; IronResource = 10;
SulfurResource = 10; SulfurResource = 10;
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController()))
{
PC->bShowMouseCursor = true;
PC->bEnableClickEvents = true;
PC->bEnableMouseOverEvents = true;
}
//Disable Character Movement //Disable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())) if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{ {
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController()); PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
} }
//Set to UI Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeUIOnly());
PlayerController->bShowMouseCursor = true;
CurrentComboString = ""; CurrentComboString = "";
UpdateComboString(CurrentComboString); UpdateComboString(CurrentComboString);
RevertActionPoints(); RevertActionPoints();
@ -73,17 +72,10 @@ void ATurnBaseCombatV2::EndCombat()
{ {
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController()); PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
} }
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController())) //Set to Game Mode Only
{ APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PC->bShowMouseCursor = false; PlayerController->SetInputMode(FInputModeGameOnly());
PC->bEnableClickEvents = false; PlayerController->bShowMouseCursor = false;
PC->bEnableMouseOverEvents = false;
}
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false);
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false);
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
} }
void ATurnBaseCombatV2::FKeyPressed() void ATurnBaseCombatV2::FKeyPressed()