Update Dialogue, Character, Inventory for Dialogue Requirements Check
This commit is contained in:
parent
a5493b8a2c
commit
aa23ea1223
BIN
Assets/UI/Items/ApartmentInvitationPass.png
(Stored with Git LFS)
Normal file
BIN
Assets/UI/Items/ApartmentInvitationPass.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/AdvancedLocomotionV4/Blueprints/CharacterLogic/ALS_Base_CharacterBP.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AdvancedLocomotionV4/Blueprints/CharacterLogic/ALS_Base_CharacterBP.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/AdvancedLocomotionV4/CharacterAssets/MannequinSkeleton/ALS_AnimBP.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AdvancedLocomotionV4/CharacterAssets/MannequinSkeleton/ALS_AnimBP.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/AdvancedLocomotionV4/Data/DataTables/MovementModelTable.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AdvancedLocomotionV4/Data/DataTables/MovementModelTable.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/BP_ChoiceButton.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/BP_ChoiceButton.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/BP_DialogueUI.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/BP_DialogueUI.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/D_Mayor_Tutorial.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/D_Mayor_Tutorial.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Mayor_tutorial_dialogue_tree.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/Mayor_tutorial_dialogue_tree.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueTree.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueTree.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/UI/BP_ChoiceButton.uasset
(Stored with Git LFS)
Normal file
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
BIN
EndlessVendetta/Content/Dialogue/UI/BP_DialogueUI.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/Animations/NewFirstPerson_AnimBP.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/Animations/NewFirstPerson_AnimBP.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/CR_MyVI_BothHands.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/CR_MyVI_BothHands.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/CR_MyVI_LeftHand.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/CR_MyVI_LeftHand.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/CR_MyVI_RightHand.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/CR_MyVI_RightHand.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_100.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_100.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_100_Montage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_100_Montage.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_150.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_150.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_150_Montage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_150_Montage.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_200.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_200.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_200_Montage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_200_Montage.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_250.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_250.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_250_Montage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_250_Montage.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_45.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_45.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_45_Montage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_45_Montage.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_75.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_75.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_75_Montage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPersonArms/VaultIt/VaultItFP_Height_75_Montage.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/Items/Favour/Icons/ApartmentInvitationPass.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Inventory/Items/Favour/Icons/ApartmentInvitationPass.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/Items/Favour/InvItem_ApartmentPartyInvitation.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Inventory/Items/Favour/InvItem_ApartmentPartyInvitation.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/Items/Favour/Materials/M_ApartmentInvitation.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Inventory/Items/Favour/Materials/M_ApartmentInvitation.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/Items/Favour/Materials/M_ApartmentInvitation_Rot.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Inventory/Items/Favour/Materials/M_ApartmentInvitation_Rot.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/M_Base.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Inventory/M_Base.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/M_Base_Rot.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Inventory/M_Base_Rot.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/MyBaseItem.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Inventory/MyBaseItem.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/UI/M_Base.uasset
(Stored with Git LFS)
Normal file
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
BIN
EndlessVendetta/Content/Inventory/UI/M_Base_Rot.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/UI/UI_InventoryEquipSlots.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Inventory/UI/UI_InventoryEquipSlots.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/UI/zeldamus.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Inventory/UI/zeldamus.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Inventory/zeldamus.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Inventory/zeldamus.uasset
(Stored with Git LFS)
Binary file not shown.
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "OpenWorldCheckpoint.h"
|
#include "OpenWorldCheckpoint.h"
|
||||||
|
#include "EndlessVendetta/InteractionInterface.h"
|
||||||
#include "OpenWorldInteractableCheckpoint.generated.h"
|
#include "OpenWorldInteractableCheckpoint.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "WaypointActor.h"
|
#include "WaypointActor.h"
|
||||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include <EndlessVendetta/EndlessVendettaGameMode.h>
|
#include "EndlessVendetta/EndlessVendettaGameMode.h"
|
||||||
#include "CheckpointClass.generated.h"
|
#include "CheckpointClass.generated.h"
|
||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedCheckpoint);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedCheckpoint);
|
||||||
|
@ -21,25 +21,23 @@ UCLASS()
|
|||||||
class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharacter
|
class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharacter
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
// ------------------- ATTRIBUTES ------------------------------
|
// ------------------- ATTRIBUTES ------------------------------
|
||||||
|
|
||||||
// Money Used for Buying things
|
// Money Used for Buying things
|
||||||
int Money = 0;
|
int Money = 0;
|
||||||
|
|
||||||
// Favours used for making bounties easier
|
|
||||||
int Favours = 999;
|
|
||||||
|
|
||||||
// Array of Main Bounties' Classes in Order
|
// Array of Main Bounties' Classes in Order
|
||||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter")
|
UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter")
|
||||||
TArray<TSubclassOf<AMainBountyClass>> MainBountyClasses;
|
TArray<TSubclassOf<AMainBountyClass>> MainBountyClasses;
|
||||||
|
|
||||||
// Reference to the Currently Active Main Bounty
|
// Reference to the Currently Active Main Bounty
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
AMainBountyClass* CurrentMainBounty;
|
AMainBountyClass* CurrentMainBounty;
|
||||||
|
|
||||||
// Index of Currently Active Main Bounty, Used for MainBountyClasses
|
// Index of Currently Active Main Bounty, Used for MainBountyClasses
|
||||||
int CurrentMainBountyIndex = 0;
|
int CurrentMainBountyIndex = 0;
|
||||||
|
|
||||||
// References to Currently Active Side Bounties
|
// References to Currently Active Side Bounties
|
||||||
TArray<ASideBountyClass*> CurrentSideBounties;
|
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
|
// Used to Check if all Main Bounties have been completed by the Bounties Tab
|
||||||
bool CompletedMainBounties = false;
|
bool CompletedMainBounties = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Favours used for making bounties easier
|
||||||
|
int Favours = 999;
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------- METHODS ---------------------------------
|
||||||
|
|
||||||
// ------------------- METHODS ---------------------------------
|
|
||||||
private:
|
private:
|
||||||
// Spawns Current Main Bounty and spawns its appropriate CP's based on level
|
// Spawns Current Main Bounty and spawns its appropriate CP's based on level
|
||||||
void SpawnMainBounty(UEVGameInstance* GI);
|
void SpawnMainBounty(UEVGameInstance* GI);
|
||||||
|
|
||||||
// Spawns Side Bounties from save system
|
// Spawns Side Bounties from save system
|
||||||
void SpawnSideBounties(UEVGameInstance* GI);
|
void SpawnSideBounties(UEVGameInstance* GI);
|
||||||
|
|
||||||
// Collects Reward for Current Main Bounty and Increments the Main Bounty Index
|
// Collects Reward for Current Main Bounty and Increments the Main Bounty Index
|
||||||
void CompleteCurrentMainBounty(UEVGameInstance* GI);
|
void CompleteCurrentMainBounty(UEVGameInstance* GI);
|
||||||
|
|
||||||
// Collects Reward for Completing a Side Bounty
|
// Collects Reward for Completing a Side Bounty
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void CompletedASideBounty(int CompletedSideBountiesUID);
|
void CompletedASideBounty(int CompletedSideBountiesUID);
|
||||||
|
|
||||||
// Replaces Normal Bounty Info UI with Unique Game Over UI
|
// Replaces Normal Bounty Info UI with Unique Game Over UI
|
||||||
void AllBountiesCompleted()
|
void AllBountiesCompleted()
|
||||||
{
|
{
|
||||||
@ -89,7 +87,7 @@ protected:
|
|||||||
|
|
||||||
// Overridden to Setup up Pause Menu Inputs
|
// Overridden to Setup up Pause Menu Inputs
|
||||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||||
|
|
||||||
// Called When Actor destroyed or Removed from Level
|
// Called When Actor destroyed or Removed from Level
|
||||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||||
|
|
||||||
@ -103,7 +101,7 @@ protected:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void OpenWorldTips();
|
void OpenWorldTips();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Used by Final Checkpoint to always load the Level set as the Open Level in here
|
// Used by Final Checkpoint to always load the Level set as the Open Level in here
|
||||||
FString GetOpenWorldLevelName()
|
FString GetOpenWorldLevelName()
|
||||||
@ -144,11 +142,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------- Pause Menu ---------------------------------
|
||||||
|
private:
|
||||||
|
|
||||||
// ------------------- Pause Menu ---------------------------------
|
|
||||||
private:
|
|
||||||
// Input Action for Opening and Closing Pause Menu
|
// Input Action for Opening and Closing Pause Menu
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
UInputAction* PauseMenuAction;
|
UInputAction* PauseMenuAction;
|
||||||
@ -159,7 +154,7 @@ private:
|
|||||||
|
|
||||||
// Reference to Pause Menu Widget
|
// Reference to Pause Menu Widget
|
||||||
UPauseMenuClass* PauseMenu;
|
UPauseMenuClass* PauseMenu;
|
||||||
|
|
||||||
// Widget Class used to Spawn Bounties Tab Widget
|
// Widget Class used to Spawn Bounties Tab Widget
|
||||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||||
TSubclassOf<UBountiesTab> BountyTabWidgetClass;
|
TSubclassOf<UBountiesTab> BountyTabWidgetClass;
|
||||||
@ -175,7 +170,7 @@ private:
|
|||||||
// Widget Class used to Spawn Bounties Tab Widget
|
// Widget Class used to Spawn Bounties Tab Widget
|
||||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||||
TSubclassOf<UBountiesTab> GameOverBountyTabWidgetClass;
|
TSubclassOf<UBountiesTab> GameOverBountyTabWidgetClass;
|
||||||
|
|
||||||
// Reference to Bounty Tab Widget
|
// Reference to Bounty Tab Widget
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
UBountiesTab* BountiesTab;
|
UBountiesTab* BountiesTab;
|
||||||
@ -213,10 +208,10 @@ private:
|
|||||||
UQuitTab* QuitTab;
|
UQuitTab* QuitTab;
|
||||||
|
|
||||||
// Creates and Stores References to each Pause Menu Tab on Begin Play
|
// 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
|
// Open or Close the Pause Menu, Defaults to Opening Bounty Tab
|
||||||
void TogglePauseMenu();
|
void TogglePauseMenu();
|
||||||
|
|
||||||
// Opens Bounties Tab
|
// Opens Bounties Tab
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
@ -252,7 +247,7 @@ private:
|
|||||||
{
|
{
|
||||||
PauseMenu->OpenNewTab(QuitTab);
|
PauseMenu->OpenNewTab(QuitTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
FBountyTabInfo BountyTabInfo;
|
FBountyTabInfo BountyTabInfo;
|
||||||
|
|
||||||
FMainBountyStruct MainBountyStruct;
|
FMainBountyStruct MainBountyStruct;
|
||||||
@ -264,7 +259,7 @@ private:
|
|||||||
if (!IsValid(BountiesTab)) return;
|
if (!IsValid(BountiesTab)) return;
|
||||||
BountyTabInfo.MainBountyStruct = MainBountyStruct;
|
BountyTabInfo.MainBountyStruct = MainBountyStruct;
|
||||||
BountyTabInfo.SideBountyStructs = SideBountyStructs;
|
BountyTabInfo.SideBountyStructs = SideBountyStructs;
|
||||||
|
|
||||||
BountiesTab->UpdateBountyTab(BountyTabInfo);
|
BountiesTab->UpdateBountyTab(BountyTabInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +268,7 @@ private:
|
|||||||
|
|
||||||
void DeActivateAllBounties()
|
void DeActivateAllBounties()
|
||||||
{
|
{
|
||||||
if (IsValid(CurrentMainBounty)) CurrentMainBounty->DeActivateFirstCheckpoint();
|
if (IsValid(CurrentMainBounty)) CurrentMainBounty->DeActivateFirstCheckpoint();
|
||||||
for (auto SideBounty : CurrentSideBounties)
|
for (auto SideBounty : CurrentSideBounties)
|
||||||
{
|
{
|
||||||
SideBounty->DeActivateFirstCheckpoint();
|
SideBounty->DeActivateFirstCheckpoint();
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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; }
|
|
||||||
};
|
|
@ -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;
|
|
||||||
}
|
|
@ -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 ********* //
|
|
||||||
// *********************************************** //
|
|
||||||
};
|
|
@ -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 ********* //
|
|
||||||
// *********************************************** //
|
|
@ -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 ************ //
|
|
||||||
// *********************************************** //
|
|
||||||
};
|
|
@ -1,7 +1,11 @@
|
|||||||
#include "DialogueChoiceNode.h"
|
#include "DialogueChoiceNode.h"
|
||||||
|
|
||||||
#include "DialogueEdge.h"
|
#include "DialogueEdge.h"
|
||||||
|
#include "DialogueTextNode.h"
|
||||||
#include "DialogueTree.h"
|
#include "DialogueTree.h"
|
||||||
|
#include "EndlessVendetta/EVGameInstance.h"
|
||||||
|
#include "EndlessVendetta/Characters/BountyHunterCharacter.h"
|
||||||
|
#include "EndlessVendetta/Inventory/InventoryComponent.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "UDialogueChoiceNode"
|
#define LOCTEXT_NAMESPACE "UDialogueChoiceNode"
|
||||||
|
|
||||||
@ -16,6 +20,40 @@ UDialogueChoiceNode::UDialogueChoiceNode()
|
|||||||
|
|
||||||
#if WITH_EDITOR
|
#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
|
FText UDialogueChoiceNode::GetNodeTitle() const
|
||||||
{
|
{
|
||||||
bool bHasValidNumberOfChoices = false;
|
bool bHasValidNumberOfChoices = false;
|
||||||
|
@ -15,6 +15,12 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||||
TArray<FString> Choices;
|
TArray<FString> Choices;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Dialogue")
|
||||||
|
bool ChoiceRequirementsMet(int ChoiceID) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Dialogue")
|
||||||
|
FString GetChoicePreText(int ChoiceID) const;
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
virtual FText GetNodeTitle() const override;
|
virtual FText GetNodeTitle() const override;
|
||||||
virtual FLinearColor GetBackgroundColor() const override;
|
virtual FLinearColor GetBackgroundColor() const override;
|
||||||
|
@ -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"),
|
||||||
|
};
|
@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "DialogueFlagEnum.h"
|
||||||
#include "GenericGraphNode.h"
|
#include "GenericGraphNode.h"
|
||||||
#include "DialogueTree.h"
|
#include "DialogueTree.h"
|
||||||
|
#include "EndlessVendetta/Inventory/ItemEnum.h"
|
||||||
#include "DialogueTextNode.generated.h"
|
#include "DialogueTextNode.generated.h"
|
||||||
|
|
||||||
UENUM(BlueprintType)
|
UENUM(BlueprintType)
|
||||||
@ -28,6 +30,17 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue")
|
||||||
ECharacterSpeaking DialogueCharacterSpeaking = ECharacterSpeaking::Character1;
|
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
|
#if WITH_EDITOR
|
||||||
virtual FText GetNodeTitle() const override;
|
virtual FText GetNodeTitle() const override;
|
||||||
virtual void SetNodeTitle(const FText& NewTitle) override;
|
virtual void SetNodeTitle(const FText& NewTitle) override;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
void UEVGameInstance::CreateNewSaveGameInstance()
|
void UEVGameInstance::CreateNewSaveGameInstance()
|
||||||
{
|
{
|
||||||
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0);
|
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0);
|
||||||
|
|
||||||
MainSaveGameInstanceRef = Cast<UMainSaveGameClass>(UGameplayStatics::CreateSaveGameObject(UMainSaveGameClass::StaticClass()));
|
MainSaveGameInstanceRef = Cast<UMainSaveGameClass>(UGameplayStatics::CreateSaveGameObject(UMainSaveGameClass::StaticClass()));
|
||||||
MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 0;
|
MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 0;
|
||||||
MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = 0;
|
MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = 0;
|
||||||
@ -30,6 +30,21 @@ void UEVGameInstance::DeleteSaveGameFiles()
|
|||||||
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0);
|
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()
|
void UEVGameInstance::OnStart()
|
||||||
{
|
{
|
||||||
Super::OnStart();
|
Super::OnStart();
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "Engine/GameInstance.h"
|
#include "Engine/GameInstance.h"
|
||||||
#include "Http.h"
|
#include "Http.h"
|
||||||
#include "MainSaveGameClass.h"
|
#include "MainSaveGameClass.h"
|
||||||
|
#include "DialogueSystem/DialogueFlagEnum.h"
|
||||||
|
#include "Inventory/BaseItem.h"
|
||||||
#include "EVGameInstance.generated.h"
|
#include "EVGameInstance.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +25,9 @@ public:
|
|||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
UMainSaveGameClass* MainSaveGameInstanceRef;
|
UMainSaveGameClass* MainSaveGameInstanceRef;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TArray<UBaseItem*> InventoryItems;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void CreateNewSaveGameInstance();
|
void CreateNewSaveGameInstance();
|
||||||
|
|
||||||
@ -31,10 +36,22 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void DeleteSaveGameFiles();
|
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:
|
protected:
|
||||||
virtual void OnStart() override;
|
virtual void OnStart() override;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "DialogueFlags", meta = (AllowPrivateAccess = "true"))
|
||||||
|
TArray<EDialogueFlag> DialogueFlags;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void IsValidSessionID(const FString& SessionID);
|
void IsValidSessionID(const FString& SessionID);
|
||||||
void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bConnectedSuccessfully);
|
void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bConnectedSuccessfully);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "ItemEnum.h"
|
||||||
#include "BaseItem.generated.h"
|
#include "BaseItem.generated.h"
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
@ -47,6 +48,8 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||||
int ItemID;
|
int ItemID;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||||
|
EItem ItemEnumerationID;
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||||
FName ItemName;
|
FName ItemName;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||||
FText Description;
|
FText Description;
|
||||||
@ -59,10 +62,10 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||||
UMaterialInterface* ItemTextureRotated;
|
UMaterialInterface* ItemTextureRotated;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||||
TEnumAsByte<EItemRotation> CurrentItemRotation = Horizontal;
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
|
||||||
TSubclassOf<AActor> ItemActor;
|
TSubclassOf<AActor> ItemActor;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
UPROPERTY(BlueprintReadWrite, Category = "Item")
|
||||||
|
TEnumAsByte<EItemRotation> CurrentItemRotation = Horizontal;
|
||||||
|
UPROPERTY(BlueprintReadWrite, Category = "Item")
|
||||||
bool bIsRotated = false;
|
bool bIsRotated = false;
|
||||||
|
|
||||||
virtual void PostInitProperties() override;
|
virtual void PostInitProperties() override;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
|
|
||||||
#include "BaseItem.h"
|
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
|
|
||||||
|
|
||||||
@ -21,6 +20,7 @@ void UInventoryComponent::InitializeComponent()
|
|||||||
Super::InitializeComponent();
|
Super::InitializeComponent();
|
||||||
PlayerCharacter = GetOwner();
|
PlayerCharacter = GetOwner();
|
||||||
ItemToPickup = nullptr;
|
ItemToPickup = nullptr;
|
||||||
|
GameInstance = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
@ -30,7 +30,7 @@ void UInventoryComponent::BeginPlay()
|
|||||||
|
|
||||||
//FTimerHandle TraceTimerHandle;
|
//FTimerHandle TraceTimerHandle;
|
||||||
//GetWorld()->GetTimerManager().SetTimer(TraceTimerHandle, this, &UInventoryComponent::ProjectTraceForItem, 0.1f, true);
|
//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)
|
bool UInventoryComponent::AddItem(UBaseItem* Item)
|
||||||
{
|
{
|
||||||
if (!IsValid(Item)) return false;
|
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))
|
if (IsRoomAvailable(Item, i))
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ bool UInventoryComponent::AddItem(UBaseItem* Item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item->RotateItem();
|
Item->RotateItem();
|
||||||
for (int i = 0; i < InventoryItems.Num(); i++)
|
for (int i = 0; i < GameInstance->InventoryItems.Num(); i++)
|
||||||
{
|
{
|
||||||
if (IsRoomAvailable(Item, i))
|
if (IsRoomAvailable(Item, i))
|
||||||
{
|
{
|
||||||
@ -124,9 +124,9 @@ FInventoryTile UInventoryComponent::IndexToTile(const int Index) const
|
|||||||
|
|
||||||
TTuple<UBaseItem*, bool> UInventoryComponent::GetItemAtIndex(const int Index)
|
TTuple<UBaseItem*, bool> UInventoryComponent::GetItemAtIndex(const int Index)
|
||||||
{
|
{
|
||||||
if (!InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false);
|
if (!GameInstance->InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false);
|
||||||
if (!IsValid(InventoryItems[Index])) return MakeTuple(nullptr, false);
|
if (!IsValid(GameInstance->InventoryItems[Index])) return MakeTuple(nullptr, false);
|
||||||
return MakeTuple(InventoryItems[Index], true);
|
return MakeTuple(GameInstance->InventoryItems[Index], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UInventoryComponent::TileToIndex(const FInventoryTile InventoryTile) const
|
int UInventoryComponent::TileToIndex(const FInventoryTile InventoryTile) const
|
||||||
@ -144,7 +144,7 @@ void UInventoryComponent::AddItemAt(UBaseItem* Item, const int TopLeftIndex)
|
|||||||
TileToCheck.X = i;
|
TileToCheck.X = i;
|
||||||
TileToCheck.Y = j;
|
TileToCheck.Y = j;
|
||||||
if (!IsTileValid(TileToCheck)) return;
|
if (!IsTileValid(TileToCheck)) return;
|
||||||
InventoryItems[TileToIndex(TileToCheck)] = Item;
|
GameInstance->InventoryItems[TileToIndex(TileToCheck)] = Item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
@ -153,9 +153,9 @@ void UInventoryComponent::AddItemAt(UBaseItem* Item, const int TopLeftIndex)
|
|||||||
TMap<UBaseItem*, FInventoryTile> UInventoryComponent::GetAllItems()
|
TMap<UBaseItem*, FInventoryTile> UInventoryComponent::GetAllItems()
|
||||||
{
|
{
|
||||||
TMap<UBaseItem*, FInventoryTile> Items;
|
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 (!IsValid(Item)) continue;
|
||||||
if (Items.Contains(Item)) continue;
|
if (Items.Contains(Item)) continue;
|
||||||
Items.Add(Item, IndexToTile(i));
|
Items.Add(Item, IndexToTile(i));
|
||||||
@ -166,11 +166,11 @@ TMap<UBaseItem*, FInventoryTile> UInventoryComponent::GetAllItems()
|
|||||||
void UInventoryComponent::RemoveItem(UBaseItem* Item)
|
void UInventoryComponent::RemoveItem(UBaseItem* Item)
|
||||||
{
|
{
|
||||||
if (!IsValid(Item)) return;
|
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;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,10 +187,20 @@ void UInventoryComponent::UpdateInventorySize(const int _Columns, const int _Row
|
|||||||
{
|
{
|
||||||
Columns = _Columns;
|
Columns = _Columns;
|
||||||
Rows = _Rows;
|
Rows = _Rows;
|
||||||
InventoryItems.SetNum(Columns * Rows);
|
GameInstance->InventoryItems.SetNum(Columns * Rows);
|
||||||
OnInventorySizeUpdated.Broadcast();
|
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)
|
void UInventoryComponent::SetPrimaryWeapon(AActor* const _PrimaryWeapon)
|
||||||
{
|
{
|
||||||
PrimaryWeapon = _PrimaryWeapon;
|
PrimaryWeapon = _PrimaryWeapon;
|
||||||
|
@ -3,8 +3,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "BaseItem.h"
|
||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
#include "InventoryStructs.h"
|
#include "InventoryStructs.h"
|
||||||
|
#include "EndlessVendetta/EVGameInstance.h"
|
||||||
|
#include "ItemEnum.h"
|
||||||
#include "InventoryComponent.generated.h"
|
#include "InventoryComponent.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +28,6 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Inventory")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Inventory")
|
||||||
float MaxPickupDistance = 200.0f;
|
float MaxPickupDistance = 200.0f;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
@ -35,12 +37,14 @@ public:
|
|||||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventoryUpdated);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventoryUpdated);
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, Category="Inventory")
|
UPROPERTY(BlueprintAssignable, Category="Inventory")
|
||||||
FOnInventoryUpdated OnInventoryUpdated;
|
FOnInventoryUpdated OnInventoryUpdated;
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventorySizeUpdated);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventorySizeUpdated);
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, Category = "Inventory")
|
UPROPERTY(BlueprintAssignable, Category = "Inventory")
|
||||||
FOnInventorySizeUpdated OnInventorySizeUpdated;
|
FOnInventorySizeUpdated OnInventorySizeUpdated;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category="Inventory")
|
UFUNCTION(BlueprintCallable, Category="Inventory")
|
||||||
bool AddItem(class UBaseItem* Item);
|
bool AddItem(class UBaseItem* Item);
|
||||||
UFUNCTION(BlueprintCallable, Category="Inventory")
|
UFUNCTION(BlueprintCallable, Category="Inventory")
|
||||||
@ -64,7 +68,11 @@ public:
|
|||||||
void SpawnItem(UBaseItem* Item, FVector Location);
|
void SpawnItem(UBaseItem* Item, FVector Location);
|
||||||
UFUNCTION(BlueprintCallable, Category = "Inventory")
|
UFUNCTION(BlueprintCallable, Category = "Inventory")
|
||||||
void UpdateInventorySize(const int _Columns, const int _Rows);
|
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);
|
void SetPrimaryWeapon(AActor* const _PrimaryWeapon);
|
||||||
AActor* GetPrimaryWeapon() const;
|
AActor* GetPrimaryWeapon() const;
|
||||||
void SetSecondaryWeapon(AActor* const _SecondaryWeapon);
|
void SetSecondaryWeapon(AActor* const _SecondaryWeapon);
|
||||||
@ -72,14 +80,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsTileValid(const FInventoryTile InventoryTile) const;
|
bool IsTileValid(const FInventoryTile InventoryTile) const;
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
AActor* PlayerCharacter;
|
AActor* PlayerCharacter;
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
AActor* ItemToPickup;
|
AActor* ItemToPickup;
|
||||||
bool IsDirty = false;
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TArray<UBaseItem*> InventoryItems;
|
UEVGameInstance* GameInstance;
|
||||||
|
bool IsDirty = false;
|
||||||
AActor* PrimaryWeapon;
|
AActor* PrimaryWeapon;
|
||||||
AActor* SecondaryWeapon;
|
AActor* SecondaryWeapon;
|
||||||
};
|
};
|
||||||
|
17
EndlessVendetta/Source/EndlessVendetta/Inventory/ItemEnum.h
Normal file
17
EndlessVendetta/Source/EndlessVendetta/Inventory/ItemEnum.h
Normal 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"),
|
||||||
|
};
|
@ -5,6 +5,8 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "BountySystem/SideBountyClass.h"
|
#include "BountySystem/SideBountyClass.h"
|
||||||
#include "BountySystem/CheckPoints/OpenWorldCheckpoint.h"
|
#include "BountySystem/CheckPoints/OpenWorldCheckpoint.h"
|
||||||
|
#include "GadgetSystem/CombatGadget.h"
|
||||||
|
#include "GadgetSystem/ReconGadget.h"
|
||||||
#include "GameFramework/SaveGame.h"
|
#include "GameFramework/SaveGame.h"
|
||||||
#include "WeaponSystem/BaseWeaponClass.h"
|
#include "WeaponSystem/BaseWeaponClass.h"
|
||||||
#include "MainSaveGameClass.generated.h"
|
#include "MainSaveGameClass.generated.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user