Update Dialogue, Character, Inventory for Dialogue Requirements Check

This commit is contained in:
Philip W 2024-03-22 09:39:18 +00:00
parent a5493b8a2c
commit aa23ea1223
62 changed files with 243 additions and 749 deletions

BIN
Assets/UI/Items/ApartmentInvitationPass.png (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.

BIN
EndlessVendetta/Content/Dialogue/UI/BP_ChoiceButton.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
EndlessVendetta/Content/Dialogue/UI/BP_DialogueUI.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
EndlessVendetta/Content/Inventory/UI/M_Base.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
EndlessVendetta/Content/Inventory/UI/M_Base_Rot.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
EndlessVendetta/Content/Inventory/UI/zeldamus.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -4,6 +4,7 @@
#include "CoreMinimal.h"
#include "OpenWorldCheckpoint.h"
#include "EndlessVendetta/InteractionInterface.h"
#include "OpenWorldInteractableCheckpoint.generated.h"
/**

View File

@ -4,9 +4,8 @@
#include "CoreMinimal.h"
#include "WaypointActor.h"
#include "EndlessVendetta/EndlessVendettaCharacter.h"
#include "GameFramework/Actor.h"
#include <EndlessVendetta/EndlessVendettaGameMode.h>
#include "EndlessVendetta/EndlessVendettaGameMode.h"
#include "CheckpointClass.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedCheckpoint);

View File

@ -21,25 +21,23 @@ UCLASS()
class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharacter
{
GENERATED_BODY()
// ------------------- ATTRIBUTES ------------------------------
// ------------------- ATTRIBUTES ------------------------------
// Money Used for Buying things
int Money = 0;
// Favours used for making bounties easier
int Favours = 999;
// Array of Main Bounties' Classes in Order
UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter")
TArray<TSubclassOf<AMainBountyClass>> MainBountyClasses;
// Reference to the Currently Active Main Bounty
UPROPERTY()
AMainBountyClass* CurrentMainBounty;
// Index of Currently Active Main Bounty, Used for MainBountyClasses
int CurrentMainBountyIndex = 0;
// References to Currently Active Side Bounties
TArray<ASideBountyClass*> CurrentSideBounties;
@ -50,28 +48,28 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac
// Used to Check if all Main Bounties have been completed by the Bounties Tab
bool CompletedMainBounties = false;
protected:
protected:
public:
// Favours used for making bounties easier
int Favours = 999;
// ------------------- METHODS ---------------------------------
// ------------------- METHODS ---------------------------------
private:
// Spawns Current Main Bounty and spawns its appropriate CP's based on level
void SpawnMainBounty(UEVGameInstance* GI);
// Spawns Side Bounties from save system
void SpawnSideBounties(UEVGameInstance* GI);
// Collects Reward for Current Main Bounty and Increments the Main Bounty Index
void CompleteCurrentMainBounty(UEVGameInstance* GI);
// Collects Reward for Completing a Side Bounty
UFUNCTION()
void CompletedASideBounty(int CompletedSideBountiesUID);
// Replaces Normal Bounty Info UI with Unique Game Over UI
void AllBountiesCompleted()
{
@ -89,7 +87,7 @@ protected:
// Overridden to Setup up Pause Menu Inputs
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
// Called When Actor destroyed or Removed from Level
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
@ -103,7 +101,7 @@ protected:
UFUNCTION(BlueprintImplementableEvent)
void OpenWorldTips();
public:
// Used by Final Checkpoint to always load the Level set as the Open Level in here
FString GetOpenWorldLevelName()
@ -144,11 +142,8 @@ public:
}
// ------------------- Pause Menu ---------------------------------
private:
// ------------------- Pause Menu ---------------------------------
private:
// Input Action for Opening and Closing Pause Menu
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
UInputAction* PauseMenuAction;
@ -159,7 +154,7 @@ private:
// Reference to Pause Menu Widget
UPauseMenuClass* PauseMenu;
// Widget Class used to Spawn Bounties Tab Widget
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
TSubclassOf<UBountiesTab> BountyTabWidgetClass;
@ -175,7 +170,7 @@ private:
// Widget Class used to Spawn Bounties Tab Widget
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
TSubclassOf<UBountiesTab> GameOverBountyTabWidgetClass;
// Reference to Bounty Tab Widget
UPROPERTY()
UBountiesTab* BountiesTab;
@ -213,10 +208,10 @@ private:
UQuitTab* QuitTab;
// Creates and Stores References to each Pause Menu Tab on Begin Play
void CreatePauseMenuTabs();
void CreatePauseMenuTabs();
// Open or Close the Pause Menu, Defaults to Opening Bounty Tab
void TogglePauseMenu();
void TogglePauseMenu();
// Opens Bounties Tab
UFUNCTION()
@ -252,7 +247,7 @@ private:
{
PauseMenu->OpenNewTab(QuitTab);
}
FBountyTabInfo BountyTabInfo;
FMainBountyStruct MainBountyStruct;
@ -264,7 +259,7 @@ private:
if (!IsValid(BountiesTab)) return;
BountyTabInfo.MainBountyStruct = MainBountyStruct;
BountyTabInfo.SideBountyStructs = SideBountyStructs;
BountiesTab->UpdateBountyTab(BountyTabInfo);
}
@ -273,7 +268,7 @@ private:
void DeActivateAllBounties()
{
if (IsValid(CurrentMainBounty)) CurrentMainBounty->DeActivateFirstCheckpoint();
if (IsValid(CurrentMainBounty)) CurrentMainBounty->DeActivateFirstCheckpoint();
for (auto SideBounty : CurrentSideBounties)
{
SideBounty->DeActivateFirstCheckpoint();

View File

@ -1,49 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyVICharacter.h"
#include "GAS/VIAbilitySystemComponent.h"
#include "Pawn/VIPawnVaultComponent.h"
#include "MotionWarpingComponent.h"
AMyVICharacter::AMyVICharacter(const FObjectInitializer& OI)
: Super(OI)
{
VaultComponent = CreateDefaultSubobject<UVIPawnVaultComponent>(TEXT("PawnVaulting"));
MotionWarpingComponent = CreateDefaultSubobject<UMotionWarpingComponent>(TEXT("MotionWarping"));
}
void AMyVICharacter::BeginPlay()
{
Super::BeginPlay();
// Init simulated proxy
if (AbilitySystem && GetLocalRole() == ROLE_SimulatedProxy)
{
// Will never have a valid controller
AbilitySystem->InitAbilityActorInfo(this, this);
}
}
void AMyVICharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
// Init authority/standalone
if (AbilitySystem)
{
AbilitySystem->InitAbilityActorInfo(this, this);
}
}
void AMyVICharacter::OnRep_Controller()
{
Super::OnRep_Controller();
// Init local client
if (AbilitySystem)
{
AbilitySystem->InitAbilityActorInfo(this, this);
}
}

View File

@ -1,35 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "MyVICharacterAbilityBase.h"
#include "MyVICharacter.generated.h"
/**
*
*/
UCLASS()
class ENDLESSVENDETTA_API AMyVICharacter : public AMyVICharacterAbilityBase
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, Category = Vault)
FVIAnimSet VaultAnimSet;
UPROPERTY(EditDefaultsOnly, Category = Vault)
FVITraceSettings VaultTraceSettings;
AMyVICharacter(const FObjectInitializer& OI);
virtual void BeginPlay() override;
virtual void PossessedBy(AController* NewController) override;
virtual void OnRep_Controller() override;
virtual UVIPawnVaultComponent* GetPawnVaultComponent_Implementation() const override { return VaultComponent; }
virtual UMotionWarpingComponent* GetMotionWarpingComponent_Implementation() const override { return MotionWarpingComponent; }
virtual FVIAnimSet GetVaultAnimSet_Implementation() const override { return VaultAnimSet; }
virtual FVITraceSettings GetVaultTraceSettings_Implementation() const override { return VaultTraceSettings; }
};

View File

@ -1,30 +0,0 @@
// Copyright (c) 2019-2022 Drowning Dragons Limited. All Rights Reserved.
#include "MyVICharacterAbilityBase.h"
#include "GAS/VIAbilitySystemComponent.h"
AMyVICharacterAbilityBase::AMyVICharacterAbilityBase(const FObjectInitializer& OI)
// : Super(OI)
{
AbilitySystem = CreateDefaultSubobject<UVIAbilitySystemComponent>(TEXT("AbilitySystem"));
AbilitySystem->SetIsReplicated(true);
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
AbilitySystemReplicationMode = (EVIGameplayEffectReplicationMode)(uint8)AbilitySystem->ReplicationMode;
}
#if WITH_EDITOR
void AMyVICharacterAbilityBase::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
if (PropertyChangedEvent.GetPropertyName().IsEqual(GET_MEMBER_NAME_CHECKED(AMyVICharacterAbilityBase, AbilitySystemReplicationMode)))
{
AbilitySystem->SetReplicationMode((EGameplayEffectReplicationMode)(uint8)AbilitySystemReplicationMode);
}
}
#endif // WITH_EDITOR
UAbilitySystemComponent* AMyVICharacterAbilityBase::GetAbilitySystemComponent() const
{
return AbilitySystem;
}

View File

@ -1,54 +0,0 @@
// Copyright (c) 2019-2022 Drowning Dragons Limited. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemInterface.h"
#include "MyVICharacterBase.h"
#include "MyVICharacterAbilityBase.generated.h"
class UVIAbilitySystemComponent;
/**
* Adds a UVIAbilitySystemComponent to your character base
* Allows switching replication mode in Blueprint for the sake of AI using Minimal instead of Mixed
*/
UCLASS()
class ENDLESSVENDETTA_API AMyVICharacterAbilityBase : public AMyVICharacterBase, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadOnly, Category = Abilities)
UVIAbilitySystemComponent* AbilitySystem;
protected:
/**
* Used by blueprints to allow changing replication mode which is usually
* only accessible via C++
*
* Recommended as follows:
* For player characters use Mixed
* For AI characters use Minimal
*/
UPROPERTY(EditDefaultsOnly, Category = Abilities)
EVIGameplayEffectReplicationMode AbilitySystemReplicationMode;
public:
AMyVICharacterAbilityBase(const FObjectInitializer& OI);
#if WITH_EDITOR
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
#endif // WITH_EDITOR
protected:
// *********************************************** //
// ******** Begin IAbilitySystemInterface ******** //
// *********************************************** //
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
// *********************************************** //
// ********* End IAbilitySystemInterface ********* //
// *********************************************** //
};

View File

@ -1,322 +0,0 @@
// Copyright (c) 2019-2022 Drowning Dragons Limited. All Rights Reserved.
#include "EndlessVendetta/Characters/MyVICharacterBase.h"
#include "Pawn/VICharacterBase.h"
#include "Net/UnrealNetwork.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Pawn/VIPawnVaultComponent.h"
#include "MotionWarpingComponent.h"
#include "VIBlueprintFunctionLibrary.h"
void AMyVICharacterBase::BeginPlay()
{
Super::BeginPlay();
VaultComponent = IVIPawnInterface::Execute_GetPawnVaultComponent(this);
MotionWarpingComponent = IVIPawnInterface::Execute_GetMotionWarpingComponent(this);
}
void AMyVICharacterBase::CheckJumpInput(float DeltaTime)
{
const bool bIsVaulting = IsVaulting();
// Server update simulated proxies with correct vaulting state
if (GetLocalRole() == ROLE_Authority && GetNetMode() != NM_Standalone)
{
bRepIsVaulting = bIsVaulting;
}
// Try to vault from local input
if (IsLocallyControlled() && VaultComponent)
{
// Disable jump if vaulting
if (VaultComponent->bPressedVault)
{
bPressedJump = false;
}
// Possibly execute vault
if (GetCharacterMovement())
{
VaultComponent->CheckVaultInput(DeltaTime, GetCharacterMovement()->MovementMode);
}
else
{
VaultComponent->CheckVaultInput(DeltaTime);
}
}
// Pick up changes in vaulting state to change movement mode
// to something other than flying (required for root motion on Z)
if (bWasVaulting && !bIsVaulting)
{
StopVaultAbility();
}
// Call super so we actually jump if we're meant to
Super::CheckJumpInput(DeltaTime);
// Cache end of frame
bWasVaulting = bIsVaulting;
}
void AMyVICharacterBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(AMyVICharacterBase, bRepIsVaulting, COND_SimulatedOnly);
DOREPLIFETIME_CONDITION(AMyVICharacterBase, RepMotionMatch, COND_SimulatedOnly);
}
void AMyVICharacterBase::Jump()
{
// If missing critical components then jump and exit
if (!VaultComponent || !GetCharacterMovement())
{
UE_LOG(LogTemp, Warning, TEXT("no vault comp or character movement"));
Super::Jump();
return;
}
// Either jump or vault, determined by VaultComponent::EVIJumpKeyPriority
if (VaultComponent->Jump(GetCharacterMovement()->GetGravityZ(), CanJump(), GetCharacterMovement()->IsFalling()))
{
UE_LOG(LogTemp, Warning, TEXT("gravity Z: %f"), GetCharacterMovement()->GetGravityZ());
// Jump normally
Super::Jump();
}
else
{
UE_LOG(LogTemp, Warning, TEXT("try to vault"));
// Jump key essentially presses the vault input
VaultComponent->Vault();
}
}
void AMyVICharacterBase::StopJumping()
{
Super::StopJumping();
// Release vault input if the jump key pressed vault instead
if (VaultComponent)
{
VaultComponent->StopJumping();
}
}
void AMyVICharacterBase::StartVaultAbility_Implementation()
{
// Called by GA_Vault
// Need to be in flying mode to have root motion on Z axis
if (GetCharacterMovement() && GetLocalRole() > ROLE_SimulatedProxy)
{
GetCharacterMovement()->SetMovementMode(MOVE_Flying);
}
}
void AMyVICharacterBase::StopVaultAbility()
{
// Called by CheckJumpInput()
// Exiting flying mode
// This may put is straight into falling if we aren't properly grounded, which is fine
if (GetCharacterMovement() && GetLocalRole() > ROLE_SimulatedProxy)
{
GetCharacterMovement()->SetMovementMode(GetCharacterMovement()->GetGroundMovementMode());
}
OnStopVaultAbility();
}
void AMyVICharacterBase::OnRep_MotionMatch()
{
// Simulated proxies update their sync points here, sent from the server during GA_Vault
MotionWarpingComponent->AddOrUpdateWarpTargetFromLocationAndRotation(TEXT("VaultSyncPoint"), RepMotionMatch.Location, RepMotionMatch.Direction.Rotation());
}
bool AMyVICharacterBase::IsVaulting() const
{
// Simulated proxies use the value provided by server
if (GetLocalRole() == ROLE_SimulatedProxy)
{
return bRepIsVaulting;
}
// Local and authority uses gameplay tags for a predicted result
if (VaultComponent)
{
return VaultComponent->IsVaulting();
}
return false;
}
// *********************************************** //
// ******** Begin Pawn Vaulting Interface ******** //
// *********************************************** //
UVIPawnVaultComponent* AMyVICharacterBase::GetPawnVaultComponent_Implementation() const
{
// You need to override this
UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AVICharacterBase::GetPawnVaultComponent not implemented for { %s }. Cannot Vault."), *GetName()));
return nullptr;
}
UMotionWarpingComponent* AMyVICharacterBase::GetMotionWarpingComponent_Implementation() const
{
// You need to override this
UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AVICharacterBase::GetMotionWarpingComponent not implemented for { %s }. Cannot Vault."), *GetName()));
return nullptr;
}
FVIAnimSet AMyVICharacterBase::GetVaultAnimSet_Implementation() const
{
// You need to override this
UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AVICharacterBase::GetVaultAnimSet not implemented for { %s }. Cannot Vault."), *GetName()));
return FVIAnimSet();
}
FVITraceSettings AMyVICharacterBase::GetVaultTraceSettings_Implementation() const
{
// You need to override this
UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AVICharacterBase::GetVaultTraceSettings not implemented for { %s }. Using default trace settings."), *GetName()), false);
return FVITraceSettings();
}
FVector AMyVICharacterBase::GetVaultDirection_Implementation() const
{
// Use input vector if available
if (GetCharacterMovement() && !GetCharacterMovement()->GetCurrentAcceleration().IsNearlyZero())
{
return GetCharacterMovement()->GetCurrentAcceleration();
}
// Use character facing direction if not providing input
return GetActorForwardVector();
}
bool AMyVICharacterBase::CanVault_Implementation() const
{
// Vaulting must finish before starting another vault attempt
if (IsVaulting())
{
UE_LOG(LogTemp, Warning, TEXT("is already vaulting"));
return false;
}
// Invalid components
if (!VaultComponent || !GetCharacterMovement())
{
UE_LOG(LogTemp, Warning, TEXT("invalid componets for vaulting"));
return false;
}
// Animation instance is required to play vault montage
if (!GetMesh() || !GetMesh()->GetAnimInstance())
{
UE_LOG(LogTemp, Warning, TEXT("Animation instance is required to play vault montage"));
return false;
}
// Authority not initialized (this isn't set on clients)
if (HasAuthority() && !VaultComponent->bVaultAbilityInitialized)
{
UE_LOG(LogTemp, Warning, TEXT("Authority not initialized (this isn't set on clients), hence cant vault"));
return false;
}
// Exit if character is in a state they cannot vault from
if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling() || GetCharacterMovement()->IsSwimming())
{
if (GetCharacterMovement()->IsMovingOnGround() && !VaultComponent->bCanVaultFromGround)
{
UE_LOG(LogTemp, Warning, TEXT("cant vault cuz on the ground and cant vault from ground"));
return false;
}
if (GetCharacterMovement()->IsFalling() && !VaultComponent->bCanVaultFromFalling)
{
UE_LOG(LogTemp, Warning, TEXT("cant vault cuz is falling and cant vault from falling"));
return false;
}
if (GetCharacterMovement()->IsSwimming() && !VaultComponent->bCanVaultFromSwimming)
{
UE_LOG(LogTemp, Warning, TEXT("cant vault from swimming"));
return false;
}
}
else
{
UE_LOG(LogTemp, Warning, TEXT("cant vault cuz isnt either swimming, walking on the ground or falling"));
return false;
}
// Can't vault while crouching
if (!VaultComponent->bCanVaultFromCrouching && GetCharacterMovement()->IsCrouching())
{
UE_LOG(LogTemp, Warning, TEXT("cant vault cuz is crouching"));
return false;
}
UE_LOG(LogTemp, Warning, TEXT("actually can vault"));
// Passed all conditions
return true;
}
void AMyVICharacterBase::OnLocalPlayerVault_Implementation(const FVector& Location, const FVector& Direction)
{
// LocalPlayer just stores the data in the same place for convenience, ease of use, memory reduction, etc
RepMotionMatch = FVIRepMotionMatch(Location, Direction);
}
void AMyVICharacterBase::GetVaultLocationAndDirection_Implementation(FVector& OutLocation, FVector& OutDirection) const
{
// Because LocalPlayer stores in the same place, no need for any testing as they all use RepMotionMatch to store this
// This is only currently used for FBIK tracing
OutLocation = RepMotionMatch.Location;
OutDirection = RepMotionMatch.Direction;
}
void AMyVICharacterBase::ReplicateMotionMatch_Implementation(const FVIRepMotionMatch& MotionMatch)
{
// GA_Vault has directed server to update it's RepMotionMatch property so that it will
// be replicated to simulated proxies with 1 decimal point of precision (net quantization)
RepMotionMatch = MotionMatch;
}
bool AMyVICharacterBase::IsWalkable_Implementation(const FHitResult& HitResult) const
{
// Surface we hit can be walked on or not
return GetCharacterMovement() && GetCharacterMovement()->IsWalkable(HitResult);
}
bool AMyVICharacterBase::CanAutoVaultInCustomMovementMode_Implementation() const
{
return true;
// Example usage commented out
/*
if (GetCharacterMovement())
{
switch (GetCharacterMovement()->CustomMovementMode)
{
case 0:
return false;
case 1: // Some example custom mode where auto vault can work
return true;
case 2:
return false;
default:
return true;
}
}
*/
}
// *********************************************** //
// ********* End Pawn Vaulting Interface ********* //
// *********************************************** //

View File

@ -1,119 +0,0 @@
// Copyright (c) 2019-2022 Drowning Dragons Limited. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "BountyHunterCharacter.h"
#include "EndlessVendetta/EndlessVendettaCharacter.h"
#include "VITypes.h"
#include "Pawn/VIPawnInterface.h"
#include "MyVICharacterBase.generated.h"
class UMotionWarpingComponent;
class UVIPawnVaultComponent;
/**
* An incomplete character base class
* Needs to inherit from IAbilitySystemInterface and implement a UVIAbilitySystemComponent
* @see: AVICharacterAbilityBase where this is done for you
*
* Requires multiple overrides which will cause errors if not correctly performed
*/
UCLASS(abstract)
class ENDLESSVENDETTA_API AMyVICharacterBase : public ACharacter, public IVIPawnInterface
{
GENERATED_BODY()
public:
/**
* Motion Warping Component used for vaulting
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Character)
UMotionWarpingComponent* MotionWarpingComponent;
/**
* Pawn Vault Component used for core vaulting logic
*
* This is added in Blueprint and must be returned via
* the IVIPawnInterface::GetPawnVaultComponent function
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Character)
UVIPawnVaultComponent* VaultComponent;
protected:
/** Simulated proxies use this to update their vaulting state based on server values */
UPROPERTY(Replicated, BlueprintReadWrite, Category = Vault)
bool bRepIsVaulting;
/** Used to detect changes in vaulting state and call StopVaultAbility() */
UPROPERTY()
bool bWasVaulting;
/**
* Simulated proxies use this to reproduce motion matching results provided
* by server in the GA_Vault gameplay ability
*
* Local players use this as a cache for FBIK testing (returned via GetVaultLocationAndDirection)
*
* Net Serialized to one decimal point of precision
*/
UPROPERTY(ReplicatedUsing="OnRep_MotionMatch", BlueprintReadWrite, Category = Vault)
FVIRepMotionMatch RepMotionMatch;
public:
virtual void BeginPlay() override;
virtual void CheckJumpInput(float DeltaTime) override;
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
public:
virtual void Jump() override;
virtual void StopJumping() override;
/** Called from gameplay ability when vault stops */
UFUNCTION(BlueprintCallable, Category = Vault)
void StopVaultAbility();
UFUNCTION(BlueprintImplementableEvent, Category = Vault)
void OnStopVaultAbility();
protected:
UFUNCTION()
void OnRep_MotionMatch();
public:
/**
* @return True if vaulting
* Correct value must be returned based on net role here
* Simulated proxies return bRepIsVaulting
* Server & Authority must return CMC bIsVaulting
*/
UFUNCTION(BlueprintPure, Category = Vault)
virtual bool IsVaulting() const;
// *********************************************** //
// *********** Begin IVIPawnInterface ************ //
// *********************************************** //
// Read VIPawnInterface.h for detailed descriptions of these functions or look
// inside their functions themselves
virtual UVIPawnVaultComponent* GetPawnVaultComponent_Implementation() const override;
virtual UMotionWarpingComponent* GetMotionWarpingComponent_Implementation() const override;
virtual USkeletalMeshComponent* GetMeshForVaultMontage_Implementation() const override { return GetMesh(); }
virtual FVIAnimSet GetVaultAnimSet_Implementation() const override;
virtual FVITraceSettings GetVaultTraceSettings_Implementation() const override;
virtual FVector GetVaultDirection_Implementation() const override;
virtual bool CanVault_Implementation() const override;
virtual void StartVaultAbility_Implementation() override;
virtual void OnLocalPlayerVault_Implementation(const FVector& Location, const FVector& Direction) override;
virtual void GetVaultLocationAndDirection_Implementation(FVector& OutLocation, FVector& OutDirection) const override;
virtual void ReplicateMotionMatch_Implementation(const FVIRepMotionMatch& MotionMatch) override;
virtual bool IsWalkable_Implementation(const FHitResult& HitResult) const override;
virtual bool CanAutoVaultInCustomMovementMode_Implementation() const override;
// *********************************************** //
// ************* End IVIPawnInterface ************ //
// *********************************************** //
};

View File

@ -1,7 +1,11 @@
#include "DialogueChoiceNode.h"
#include "DialogueEdge.h"
#include "DialogueTextNode.h"
#include "DialogueTree.h"
#include "EndlessVendetta/EVGameInstance.h"
#include "EndlessVendetta/Characters/BountyHunterCharacter.h"
#include "EndlessVendetta/Inventory/InventoryComponent.h"
#define LOCTEXT_NAMESPACE "UDialogueChoiceNode"
@ -16,6 +20,40 @@ UDialogueChoiceNode::UDialogueChoiceNode()
#if WITH_EDITOR
bool UDialogueChoiceNode::ChoiceRequirementsMet(const int ChoiceID) const
{
if (ChoiceID < 0 || ChoiceID >= Choices.Num()) return false;
if (ChildrenNodes.Num() == 0) return false;
if (!Cast<UDialogueTextNode>(ChildrenNodes[ChoiceID])) return false;
const UEVGameInstance* GameInstance = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
const UInventoryComponent* InventoryComponent = Cast<UInventoryComponent>(GetWorld()->GetFirstPlayerController()->GetPawn()->GetComponentByClass(UInventoryComponent::StaticClass()));
const ABountyHunterCharacter* PlayerCharacter = Cast<ABountyHunterCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn());
UDialogueTextNode* TextNode = Cast<UDialogueTextNode>(ChildrenNodes[ChoiceID]);
for (const EDialogueFlag Flag : TextNode->RequiredFlags)
{
if (!GameInstance->HasDialogueFlag(Flag)) return false;
}
for (const EItem Item : TextNode->RequiredItemsByEnumID)
{
if (!InventoryComponent->HasItemByEnumID(Item)) return false;
}
for (const int ItemID : TextNode->RequiredItemsByID)
{
if (!InventoryComponent->HasItemByItemID(ItemID)) return false;
}
if (TextNode->RequiredFavours > PlayerCharacter->Favours) return false;
return true;
}
FString UDialogueChoiceNode::GetChoicePreText(const int ChoiceID) const
{
if (ChoiceID < 0 || ChoiceID >= Choices.Num()) return "INVALID";
if (ChildrenNodes.Num() == 0) return "INVALID";
if (!Cast<UDialogueTextNode>(ChildrenNodes[ChoiceID])) return "INVALID";
const UDialogueTextNode* TextNode = Cast<UDialogueTextNode>(ChildrenNodes[ChoiceID]);
return TextNode->RequirementPreText.ToString();
}
FText UDialogueChoiceNode::GetNodeTitle() const
{
bool bHasValidNumberOfChoices = false;

View File

@ -15,6 +15,12 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
TArray<FString> Choices;
UFUNCTION(BlueprintCallable, Category = "Dialogue")
bool ChoiceRequirementsMet(int ChoiceID) const;
UFUNCTION(BlueprintCallable, Category = "Dialogue")
FString GetChoicePreText(int ChoiceID) const;
#if WITH_EDITOR
virtual FText GetNodeTitle() const override;
virtual FLinearColor GetBackgroundColor() const override;

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "DialogueFlagEnum.generated.h"
/**
*
*/
UENUM(BlueprintType)
enum class EDialogueFlag : uint8
{
None UMETA(DisplayName = "None"),
TestFlag1 UMETA(DisplayName = "Test Flag DO NOT USE"),
TestFlag2 UMETA(DisplayName = "Test Flag DO NOT USE"),
};

View File

@ -1,8 +1,10 @@
#pragma once
#include "CoreMinimal.h"
#include "DialogueFlagEnum.h"
#include "GenericGraphNode.h"
#include "DialogueTree.h"
#include "EndlessVendetta/Inventory/ItemEnum.h"
#include "DialogueTextNode.generated.h"
UENUM(BlueprintType)
@ -28,6 +30,17 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
ECharacterSpeaking DialogueCharacterSpeaking = ECharacterSpeaking::Character1;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement")
TArray<EDialogueFlag> RequiredFlags;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement")
TArray<EItem> RequiredItemsByEnumID;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement")
TArray<int> RequiredItemsByID;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement")
int RequiredFavours = 0;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement")
FText RequirementPreText = FText::FromString("None");
#if WITH_EDITOR
virtual FText GetNodeTitle() const override;
virtual void SetNodeTitle(const FText& NewTitle) override;

View File

@ -8,7 +8,7 @@
void UEVGameInstance::CreateNewSaveGameInstance()
{
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0);
MainSaveGameInstanceRef = Cast<UMainSaveGameClass>(UGameplayStatics::CreateSaveGameObject(UMainSaveGameClass::StaticClass()));
MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 0;
MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = 0;
@ -30,6 +30,21 @@ void UEVGameInstance::DeleteSaveGameFiles()
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0);
}
void UEVGameInstance::AddDialogueFlag(const EDialogueFlag Flag)
{
if (!HasDialogueFlag(Flag)) DialogueFlags.Add(Flag);
}
void UEVGameInstance::RemoveDialogueFlag(const EDialogueFlag Flag)
{
if (HasDialogueFlag(Flag)) DialogueFlags.Remove(Flag);
}
bool UEVGameInstance::HasDialogueFlag(const EDialogueFlag Flag) const
{
return DialogueFlags.Contains(Flag);
}
void UEVGameInstance::OnStart()
{
Super::OnStart();

View File

@ -6,6 +6,8 @@
#include "Engine/GameInstance.h"
#include "Http.h"
#include "MainSaveGameClass.h"
#include "DialogueSystem/DialogueFlagEnum.h"
#include "Inventory/BaseItem.h"
#include "EVGameInstance.generated.h"
/**
@ -23,6 +25,9 @@ public:
UPROPERTY()
UMainSaveGameClass* MainSaveGameInstanceRef;
UPROPERTY()
TArray<UBaseItem*> InventoryItems;
UFUNCTION(BlueprintCallable)
void CreateNewSaveGameInstance();
@ -31,10 +36,22 @@ public:
UFUNCTION(BlueprintCallable)
void DeleteSaveGameFiles();
UFUNCTION(BlueprintCallable, Category = "DialogueFlags")
void AddDialogueFlag(EDialogueFlag Flag);
UFUNCTION(BlueprintCallable, Category = "DialogueFlags")
void RemoveDialogueFlag(EDialogueFlag Flag);
UFUNCTION(BlueprintCallable, Category = "DialogueFlags")
bool HasDialogueFlag(EDialogueFlag Flag) const;
protected:
virtual void OnStart() override;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DialogueFlags", meta = (AllowPrivateAccess = "true"))
TArray<EDialogueFlag> DialogueFlags;
private:
void IsValidSessionID(const FString& SessionID);
void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bConnectedSuccessfully);

View File

@ -3,6 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "ItemEnum.h"
#include "BaseItem.generated.h"
USTRUCT(BlueprintType)
@ -47,6 +48,8 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
int ItemID;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
EItem ItemEnumerationID;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
FName ItemName;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
FText Description;
@ -59,10 +62,10 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
UMaterialInterface* ItemTextureRotated;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
TEnumAsByte<EItemRotation> CurrentItemRotation = Horizontal;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
TSubclassOf<AActor> ItemActor;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
UPROPERTY(BlueprintReadWrite, Category = "Item")
TEnumAsByte<EItemRotation> CurrentItemRotation = Horizontal;
UPROPERTY(BlueprintReadWrite, Category = "Item")
bool bIsRotated = false;
virtual void PostInitProperties() override;

View File

@ -3,7 +3,6 @@
#include "InventoryComponent.h"
#include "BaseItem.h"
#include "Camera/CameraComponent.h"
@ -21,6 +20,7 @@ void UInventoryComponent::InitializeComponent()
Super::InitializeComponent();
PlayerCharacter = GetOwner();
ItemToPickup = nullptr;
GameInstance = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
}
// Called when the game starts
@ -30,7 +30,7 @@ void UInventoryComponent::BeginPlay()
//FTimerHandle TraceTimerHandle;
//GetWorld()->GetTimerManager().SetTimer(TraceTimerHandle, this, &UInventoryComponent::ProjectTraceForItem, 0.1f, true);
InventoryItems.Init(nullptr, Columns * Rows);
GameInstance->InventoryItems.Init(nullptr, Columns * Rows);
}
@ -49,7 +49,7 @@ void UInventoryComponent::TickComponent(float DeltaTime, ELevelTick TickType, FA
bool UInventoryComponent::AddItem(UBaseItem* Item)
{
if (!IsValid(Item)) return false;
for (int i = 0; i < InventoryItems.Num(); i++)
for (int i = 0; i < GameInstance->InventoryItems.Num(); i++)
{
if (IsRoomAvailable(Item, i))
{
@ -58,7 +58,7 @@ bool UInventoryComponent::AddItem(UBaseItem* Item)
}
}
Item->RotateItem();
for (int i = 0; i < InventoryItems.Num(); i++)
for (int i = 0; i < GameInstance->InventoryItems.Num(); i++)
{
if (IsRoomAvailable(Item, i))
{
@ -124,9 +124,9 @@ FInventoryTile UInventoryComponent::IndexToTile(const int Index) const
TTuple<UBaseItem*, bool> UInventoryComponent::GetItemAtIndex(const int Index)
{
if (!InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false);
if (!IsValid(InventoryItems[Index])) return MakeTuple(nullptr, false);
return MakeTuple(InventoryItems[Index], true);
if (!GameInstance->InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false);
if (!IsValid(GameInstance->InventoryItems[Index])) return MakeTuple(nullptr, false);
return MakeTuple(GameInstance->InventoryItems[Index], true);
}
int UInventoryComponent::TileToIndex(const FInventoryTile InventoryTile) const
@ -144,7 +144,7 @@ void UInventoryComponent::AddItemAt(UBaseItem* Item, const int TopLeftIndex)
TileToCheck.X = i;
TileToCheck.Y = j;
if (!IsTileValid(TileToCheck)) return;
InventoryItems[TileToIndex(TileToCheck)] = Item;
GameInstance->InventoryItems[TileToIndex(TileToCheck)] = Item;
}
}
IsDirty = true;
@ -153,9 +153,9 @@ void UInventoryComponent::AddItemAt(UBaseItem* Item, const int TopLeftIndex)
TMap<UBaseItem*, FInventoryTile> UInventoryComponent::GetAllItems()
{
TMap<UBaseItem*, FInventoryTile> Items;
for (int i = 0; i < InventoryItems.Num(); i++)
for (int i = 0; i < GameInstance->InventoryItems.Num(); i++)
{
UBaseItem* Item = InventoryItems[i];
UBaseItem* Item = GameInstance->InventoryItems[i];
if (!IsValid(Item)) continue;
if (Items.Contains(Item)) continue;
Items.Add(Item, IndexToTile(i));
@ -166,11 +166,11 @@ TMap<UBaseItem*, FInventoryTile> UInventoryComponent::GetAllItems()
void UInventoryComponent::RemoveItem(UBaseItem* Item)
{
if (!IsValid(Item)) return;
for (int i = 0; i < InventoryItems.Num(); i++)
for (int i = 0; i < GameInstance->InventoryItems.Num(); i++)
{
if (InventoryItems[i] == Item)
if (GameInstance->InventoryItems[i] == Item)
{
InventoryItems[i] = nullptr;
GameInstance->InventoryItems[i] = nullptr;
IsDirty = true;
}
}
@ -187,10 +187,20 @@ void UInventoryComponent::UpdateInventorySize(const int _Columns, const int _Row
{
Columns = _Columns;
Rows = _Rows;
InventoryItems.SetNum(Columns * Rows);
GameInstance->InventoryItems.SetNum(Columns * Rows);
OnInventorySizeUpdated.Broadcast();
}
bool UInventoryComponent::HasItemByEnumID(EItem ItemEnumID) const
{
return GameInstance->InventoryItems.ContainsByPredicate([ItemEnumID](const UBaseItem* Item) { return IsValid(Item) && Item->ItemEnumerationID == ItemEnumID; });
}
bool UInventoryComponent::HasItemByItemID(int ItemID) const
{
return GameInstance->InventoryItems.ContainsByPredicate([ItemID](const UBaseItem* Item) { return IsValid(Item) && Item->ItemID == ItemID; });
}
void UInventoryComponent::SetPrimaryWeapon(AActor* const _PrimaryWeapon)
{
PrimaryWeapon = _PrimaryWeapon;

View File

@ -3,8 +3,11 @@
#pragma once
#include "CoreMinimal.h"
#include "BaseItem.h"
#include "Components/ActorComponent.h"
#include "InventoryStructs.h"
#include "EndlessVendetta/EVGameInstance.h"
#include "ItemEnum.h"
#include "InventoryComponent.generated.h"
@ -25,7 +28,6 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Inventory")
float MaxPickupDistance = 200.0f;
protected:
// Called when the game starts
virtual void BeginPlay() override;
@ -35,12 +37,14 @@ public:
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventoryUpdated);
UPROPERTY(BlueprintAssignable, Category="Inventory")
FOnInventoryUpdated OnInventoryUpdated;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventorySizeUpdated);
UPROPERTY(BlueprintAssignable, Category = "Inventory")
FOnInventorySizeUpdated OnInventorySizeUpdated;
UFUNCTION(BlueprintCallable, Category="Inventory")
bool AddItem(class UBaseItem* Item);
UFUNCTION(BlueprintCallable, Category="Inventory")
@ -64,7 +68,11 @@ public:
void SpawnItem(UBaseItem* Item, FVector Location);
UFUNCTION(BlueprintCallable, Category = "Inventory")
void UpdateInventorySize(const int _Columns, const int _Rows);
UFUNCTION(BlueprintCallable, Category = "Inventory")
bool HasItemByEnumID(EItem ItemEnumID) const;
UFUNCTION(BlueprintCallable, Category = "Inventory")
bool HasItemByItemID(int ItemID) const;
void SetPrimaryWeapon(AActor* const _PrimaryWeapon);
AActor* GetPrimaryWeapon() const;
void SetSecondaryWeapon(AActor* const _SecondaryWeapon);
@ -72,14 +80,14 @@ public:
private:
bool IsTileValid(const FInventoryTile InventoryTile) const;
UPROPERTY()
AActor* PlayerCharacter;
UPROPERTY()
AActor* ItemToPickup;
bool IsDirty = false;
UPROPERTY()
TArray<UBaseItem*> InventoryItems;
UEVGameInstance* GameInstance;
bool IsDirty = false;
AActor* PrimaryWeapon;
AActor* SecondaryWeapon;
};

View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ItemEnum.generated.h"
/**
*
*/
UENUM(BlueprintType)
enum class EItem : uint8
{
None UMETA(DisplayName = "None"),
ApartmentPartyInvite UMETA(DisplayName = "Apartment Party Invite"),
};

View File

@ -5,6 +5,8 @@
#include "CoreMinimal.h"
#include "BountySystem/SideBountyClass.h"
#include "BountySystem/CheckPoints/OpenWorldCheckpoint.h"
#include "GadgetSystem/CombatGadget.h"
#include "GadgetSystem/ReconGadget.h"
#include "GameFramework/SaveGame.h"
#include "WeaponSystem/BaseWeaponClass.h"
#include "MainSaveGameClass.generated.h"