Update Character Interact to Include Dialogue
This commit is contained in:
parent
d30425d6e5
commit
e6b7edcf8c
1
EndlessVendetta/.gitignore
vendored
1
EndlessVendetta/.gitignore
vendored
@ -16,6 +16,7 @@
|
|||||||
### UnrealEngine ###
|
### UnrealEngine ###
|
||||||
# Visual Studio 2015 user specific files
|
# Visual Studio 2015 user specific files
|
||||||
.vs/
|
.vs/
|
||||||
|
.idea/
|
||||||
|
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.slo
|
*.slo
|
||||||
|
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.
@ -3,8 +3,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "AC_PlayerDialogueInterpreter.h"
|
||||||
#include "DialogueTree.h"
|
#include "DialogueTree.h"
|
||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
|
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||||
|
#include "EndlessVendetta/InteractionInterface.h"
|
||||||
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "AC_Dialogue.generated.h"
|
#include "AC_Dialogue.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@ -14,6 +18,18 @@ class ENDLESSVENDETTA_API UAC_Dialogue : public UActorComponent
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void Interact() const;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||||
UDialogueTree* DialogueTree;
|
UDialogueTree* DialogueTree;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline void UAC_Dialogue::Interact() const
|
||||||
|
{
|
||||||
|
GLog->Log("Interacting with dialogue");
|
||||||
|
if (!IsValid(DialogueTree)) return;
|
||||||
|
AEndlessVendettaCharacter* Character = Cast<AEndlessVendettaCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
|
||||||
|
if (!IsValid(Cast<UAC_PlayerDialogueInterpreter>(Character->GetComponentByClass(UAC_PlayerDialogueInterpreter::StaticClass())))) return;
|
||||||
|
Cast<UAC_PlayerDialogueInterpreter>(Character->GetComponentByClass(UAC_PlayerDialogueInterpreter::StaticClass()))->StartDialogue(DialogueTree);
|
||||||
|
Character->bIsInDialogue = true;
|
||||||
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "AC_PlayerDialogueInterpreter.h"
|
#include "AC_PlayerDialogueInterpreter.h"
|
||||||
|
|
||||||
|
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||||
|
|
||||||
|
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UAC_PlayerDialogueInterpreter::UAC_PlayerDialogueInterpreter()
|
UAC_PlayerDialogueInterpreter::UAC_PlayerDialogueInterpreter()
|
||||||
@ -37,39 +39,65 @@ void UAC_PlayerDialogueInterpreter::StartDialogue(UDialogueTree* DialogueTree)
|
|||||||
CurrentDialogueTree = DialogueTree;
|
CurrentDialogueTree = DialogueTree;
|
||||||
CurrentTextNode = Cast<UDialogueTextNode>(DialogueTree->RootNodes[0]->ChildrenNodes[0]);
|
CurrentTextNode = Cast<UDialogueTextNode>(DialogueTree->RootNodes[0]->ChildrenNodes[0]);
|
||||||
OnStartDialogue.Broadcast(CurrentTextNode);
|
OnStartDialogue.Broadcast(CurrentTextNode);
|
||||||
|
|
||||||
|
if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
|
||||||
|
{
|
||||||
|
FInputModeUIOnly InputModeData;
|
||||||
|
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||||
|
PlayerController->SetInputMode(InputModeData);
|
||||||
|
PlayerController->bShowMouseCursor = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAC_PlayerDialogueInterpreter::NextDialogue()
|
void UAC_PlayerDialogueInterpreter::NextDialogue()
|
||||||
{
|
{
|
||||||
if (IsValid(CurrentTextNode))
|
if (!IsValid(CurrentTextNode)) return;
|
||||||
|
if (CurrentTextNode->ChildrenNodes.Num() == 0)
|
||||||
{
|
{
|
||||||
if (Cast<UDialogueChoiceNode>(CurrentTextNode->ChildrenNodes[0]))
|
EndDialogue();
|
||||||
{
|
return;
|
||||||
CurrentTextNode = nullptr;
|
}
|
||||||
CurrentChoiceNode = Cast<UDialogueChoiceNode>(CurrentTextNode->ChildrenNodes[0]);
|
if (Cast<UDialogueChoiceNode>(CurrentTextNode->ChildrenNodes[0]))
|
||||||
OnChoiceDialogue.Broadcast(CurrentChoiceNode);
|
{
|
||||||
}
|
CurrentChoiceNode = Cast<UDialogueChoiceNode>(CurrentTextNode->ChildrenNodes[0]);
|
||||||
else
|
OnChoiceDialogue.Broadcast(CurrentChoiceNode);
|
||||||
{
|
CurrentTextNode = nullptr;
|
||||||
CurrentChoiceNode = nullptr;
|
}
|
||||||
CurrentTextNode = Cast<UDialogueTextNode>(CurrentTextNode->ChildrenNodes[0]);
|
else
|
||||||
OnNextDialogue.Broadcast(CurrentTextNode);
|
{
|
||||||
}
|
CurrentTextNode = Cast<UDialogueTextNode>(CurrentTextNode->ChildrenNodes[0]);
|
||||||
|
OnNextDialogue.Broadcast(CurrentTextNode);
|
||||||
|
CurrentChoiceNode = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAC_PlayerDialogueInterpreter::MakeChoiceDialogue(const int Choice)
|
void UAC_PlayerDialogueInterpreter::MakeChoiceDialogue(const int Choice)
|
||||||
{
|
{
|
||||||
if (Cast<UDialogueChoiceNode>(CurrentTextNode->ChildrenNodes[Choice]))
|
if (!IsValid(CurrentChoiceNode)) return;
|
||||||
|
if (Cast<UDialogueChoiceNode>(CurrentChoiceNode->ChildrenNodes[Choice]))
|
||||||
{
|
{
|
||||||
CurrentTextNode = nullptr;
|
CurrentChoiceNode = Cast<UDialogueChoiceNode>(CurrentChoiceNode->ChildrenNodes[Choice]);
|
||||||
CurrentChoiceNode = Cast<UDialogueChoiceNode>(CurrentTextNode->ChildrenNodes[Choice]);
|
|
||||||
OnChoiceDialogue.Broadcast(CurrentChoiceNode);
|
OnChoiceDialogue.Broadcast(CurrentChoiceNode);
|
||||||
|
CurrentTextNode = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CurrentChoiceNode = nullptr;
|
CurrentTextNode = Cast<UDialogueTextNode>(CurrentChoiceNode->ChildrenNodes[Choice]);
|
||||||
CurrentTextNode = Cast<UDialogueTextNode>(CurrentTextNode->ChildrenNodes[Choice]);
|
|
||||||
OnNextDialogue.Broadcast(CurrentTextNode);
|
OnNextDialogue.Broadcast(CurrentTextNode);
|
||||||
|
CurrentChoiceNode = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAC_PlayerDialogueInterpreter::EndDialogue()
|
||||||
|
{
|
||||||
|
CurrentChoiceNode = nullptr;
|
||||||
|
CurrentTextNode = nullptr;
|
||||||
|
OnEndDialogue.Broadcast();
|
||||||
|
|
||||||
|
if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
|
||||||
|
{
|
||||||
|
const FInputModeGameAndUI InputModeData;
|
||||||
|
PlayerController->SetInputMode(InputModeData);
|
||||||
|
PlayerController->bShowMouseCursor = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,18 @@ public:
|
|||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnChoiceDialogue, UDialogueChoiceNode*, ChoiceNode);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnChoiceDialogue, UDialogueChoiceNode*, ChoiceNode);
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnEndDialogue);
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
||||||
FOnStartDialogue OnStartDialogue;
|
FOnStartDialogue OnStartDialogue;
|
||||||
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
||||||
FOnNextDialogue OnNextDialogue;
|
FOnNextDialogue OnNextDialogue;
|
||||||
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
||||||
FOnChoiceDialogue OnChoiceDialogue;
|
FOnChoiceDialogue OnChoiceDialogue;
|
||||||
|
UPROPERTY(BlueprintAssignable, Category = "Dialogue")
|
||||||
|
FOnEndDialogue OnEndDialogue;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Dialogue")
|
||||||
UDialogueTree* CurrentDialogueTree;
|
UDialogueTree* CurrentDialogueTree;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -54,4 +58,6 @@ public:
|
|||||||
void NextDialogue();
|
void NextDialogue();
|
||||||
UFUNCTION(BlueprintCallable, Category = "Dialogue")
|
UFUNCTION(BlueprintCallable, Category = "Dialogue")
|
||||||
void MakeChoiceDialogue(int Choice);
|
void MakeChoiceDialogue(int Choice);
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Dialogue")
|
||||||
|
void EndDialogue();
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
#include "DialogueRootNode.h"
|
||||||
|
#include "DialogueTree.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "UDialogueChoiceNode"
|
||||||
|
|
||||||
|
UDialogueRootNode::UDialogueRootNode()
|
||||||
|
{
|
||||||
|
#if WITH_EDITORONLY_DATA
|
||||||
|
CompatibleGraphType = UDialogueTree::StaticClass();
|
||||||
|
|
||||||
|
ContextMenuName = LOCTEXT("ConextMenuName", "Root Node");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
FText UDialogueRootNode::GetNodeTitle() const
|
||||||
|
{
|
||||||
|
return LOCTEXT("Root Node", "ROOT");
|
||||||
|
}
|
||||||
|
|
||||||
|
FLinearColor UDialogueRootNode::GetBackgroundColor() const
|
||||||
|
{
|
||||||
|
if (const UDialogueTree* DialogueTree = Cast<UDialogueTree>(GetGraph()); DialogueTree == nullptr)
|
||||||
|
return Super::GetBackgroundColor();
|
||||||
|
|
||||||
|
return FLinearColor(1.f, 1.f, 1.f, 1.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GenericGraphNode.h"
|
||||||
|
#include "DialogueRootNode.generated.h"
|
||||||
|
|
||||||
|
UCLASS(Blueprintable)
|
||||||
|
class UDialogueRootNode : public UGenericGraphNode
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UDialogueRootNode();;
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual FText GetNodeTitle() const override;
|
||||||
|
|
||||||
|
virtual FLinearColor GetBackgroundColor() const override;
|
||||||
|
#endif
|
||||||
|
};
|
@ -37,7 +37,6 @@ FText UDialogueTextNode::GetNodeTitle() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Wrapped Text: %s"), *WrappedText);
|
|
||||||
return FText::FromString(WrappedText);
|
return FText::FromString(WrappedText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "GameFramework/MovementComponent.h"
|
#include "GameFramework/MovementComponent.h"
|
||||||
#include "Inventory/InventoryComponent.h"
|
#include "Inventory/InventoryComponent.h"
|
||||||
#include "EndlessVendettaGameMode.h"
|
#include "EndlessVendettaGameMode.h"
|
||||||
|
#include "DialogueSystem/AC_Dialogue.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -102,7 +103,7 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
|
|||||||
}
|
}
|
||||||
if (bPressedJump)
|
if (bPressedJump)
|
||||||
{
|
{
|
||||||
if(CurrentStamina <= 0.0f)
|
if (CurrentStamina <= 0.0f)
|
||||||
{
|
{
|
||||||
CurrentStamina -= 20.0f;
|
CurrentStamina -= 20.0f;
|
||||||
}
|
}
|
||||||
@ -123,7 +124,7 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
|
|||||||
}
|
}
|
||||||
if (!bIsPlayerSprinting)
|
if (!bIsPlayerSprinting)
|
||||||
{
|
{
|
||||||
if(CurrentStamina >= 100.0f)
|
if (CurrentStamina >= 100.0f)
|
||||||
{
|
{
|
||||||
CurrentStamina = 100.0f;
|
CurrentStamina = 100.0f;
|
||||||
return;
|
return;
|
||||||
@ -174,7 +175,7 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
|
|||||||
//Jumping
|
//Jumping
|
||||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);
|
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);
|
||||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
|
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
|
||||||
|
|
||||||
//Moving
|
//Moving
|
||||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move);
|
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move);
|
||||||
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Sprint);
|
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Sprint);
|
||||||
@ -211,6 +212,11 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
|
|||||||
|
|
||||||
void AEndlessVendettaCharacter::Interact()
|
void AEndlessVendettaCharacter::Interact()
|
||||||
{
|
{
|
||||||
|
if (bIsInDialogue)
|
||||||
|
{
|
||||||
|
Cast<UAC_PlayerDialogueInterpreter>(GetComponentByClass(UAC_PlayerDialogueInterpreter::StaticClass()))->NextDialogue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (PlayerOnShip)
|
if (PlayerOnShip)
|
||||||
{
|
{
|
||||||
SpaceShip->PlayerInteracting();
|
SpaceShip->PlayerInteracting();
|
||||||
@ -234,6 +240,10 @@ void AEndlessVendettaCharacter::Interact()
|
|||||||
UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName());
|
UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName());
|
||||||
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
|
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
|
||||||
if (InteractableActor) InteractableActor->Interact();
|
if (InteractableActor) InteractableActor->Interact();
|
||||||
|
if (UAC_Dialogue* Dialogue = Cast<UAC_Dialogue>(HitActor->GetComponentByClass(UAC_Dialogue::StaticClass())))
|
||||||
|
{
|
||||||
|
Dialogue->Interact();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -341,7 +351,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
if (IsValid(PrimaryWeapon))
|
if (IsValid(PrimaryWeapon))
|
||||||
{
|
{
|
||||||
PrimaryWeapon->DetachFromActor(DetatchRules);
|
PrimaryWeapon->DetachFromActor(DetatchRules);
|
||||||
PrimaryWeapon->SetActorLocation(FVector(0,0,0), false, nullptr, ETeleportType::None);
|
PrimaryWeapon->SetActorLocation(FVector(0, 0, 0), false, nullptr, ETeleportType::None);
|
||||||
PrimaryWeapon->SetActorHiddenInGame(true);
|
PrimaryWeapon->SetActorHiddenInGame(true);
|
||||||
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), PrimaryWeapon->IsHidden());
|
UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), PrimaryWeapon->IsHidden());
|
||||||
@ -351,7 +361,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
Cast<AEndlessVendettaGameMode>(GetWorld()->GetAuthGameMode())->SendEvent("DeEquip", "Pri");
|
Cast<AEndlessVendettaGameMode>(GetWorld()->GetAuthGameMode())->SendEvent("DeEquip", "Pri");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(bIsWeaponPickedUp)
|
if (bIsWeaponPickedUp)
|
||||||
{
|
{
|
||||||
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
||||||
bIsWeaponPickedUp = false;
|
bIsWeaponPickedUp = false;
|
||||||
@ -390,12 +400,12 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
||||||
FDetachmentTransformRules DetatchRules(EDetachmentRule::KeepWorld, false);
|
FDetachmentTransformRules DetatchRules(EDetachmentRule::KeepWorld, false);
|
||||||
|
|
||||||
if (bIsReloading) return;
|
if (bIsReloading) return;
|
||||||
if (IsValid(SecondaryWeapon))
|
if (IsValid(SecondaryWeapon))
|
||||||
{
|
{
|
||||||
SecondaryWeapon->DetachFromActor(DetatchRules);
|
SecondaryWeapon->DetachFromActor(DetatchRules);
|
||||||
SecondaryWeapon->SetActorLocation(FVector(0,0,0), false, nullptr, ETeleportType::None);
|
SecondaryWeapon->SetActorLocation(FVector(0, 0, 0), false, nullptr, ETeleportType::None);
|
||||||
SecondaryWeapon->SetActorHiddenInGame(true);
|
SecondaryWeapon->SetActorHiddenInGame(true);
|
||||||
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
|
UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
|
||||||
@ -404,8 +414,8 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
GLog->Log("Secondary Weapon Put Away");
|
GLog->Log("Secondary Weapon Put Away");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bIsWeaponPickedUp)
|
if (bIsWeaponPickedUp)
|
||||||
{
|
{
|
||||||
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
||||||
bIsWeaponPickedUp = false;
|
bIsWeaponPickedUp = false;
|
||||||
@ -415,11 +425,11 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
|
|
||||||
if (GadgetManager->IsValidReconGadget() && GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;
|
if (GadgetManager->IsValidReconGadget() && GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;
|
||||||
if (GadgetManager->IsValidCombatGadget() && GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;
|
if (GadgetManager->IsValidCombatGadget() && GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;
|
||||||
|
|
||||||
if(!IsValid(SecondaryWeapon))
|
if (!IsValid(SecondaryWeapon))
|
||||||
{
|
{
|
||||||
bHasRifle = true;
|
bHasRifle = true;
|
||||||
if(!bIsSecondaryWeaponCreated)
|
if (!bIsSecondaryWeaponCreated)
|
||||||
{
|
{
|
||||||
SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
|
SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
|
||||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||||
@ -438,7 +448,7 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
|
|
||||||
void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
||||||
{
|
{
|
||||||
if(Outhit->ActorHasTag("PrimaryWeapon"))
|
if (Outhit->ActorHasTag("PrimaryWeapon"))
|
||||||
{
|
{
|
||||||
if (IsValid(PrimaryWeapon))
|
if (IsValid(PrimaryWeapon))
|
||||||
{
|
{
|
||||||
@ -449,7 +459,7 @@ void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
|||||||
Outhit->Destroy();
|
Outhit->Destroy();
|
||||||
EquipPrimary();
|
EquipPrimary();
|
||||||
}
|
}
|
||||||
if(Outhit->ActorHasTag("SecondaryWeapon"))
|
if (Outhit->ActorHasTag("SecondaryWeapon"))
|
||||||
{
|
{
|
||||||
if (IsValid(SecondaryWeapon))
|
if (IsValid(SecondaryWeapon))
|
||||||
{
|
{
|
||||||
@ -565,7 +575,7 @@ void AEndlessVendettaCharacter::Move(const FInputActionValue& Value)
|
|||||||
SpaceShip->MoveShip(MovementVector);
|
SpaceShip->MoveShip(MovementVector);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Controller != nullptr)
|
if (Controller != nullptr)
|
||||||
{
|
{
|
||||||
// add movement
|
// add movement
|
||||||
@ -669,7 +679,7 @@ void AEndlessVendettaCharacter::UpdateInventorySize(int Cols, int Rows)
|
|||||||
{
|
{
|
||||||
Inventory->UpdateInventorySize(Cols, Rows);
|
Inventory->UpdateInventorySize(Cols, Rows);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Warning, TEXT("No Vaild Inventory"));
|
UE_LOG(LogTemp, Warning, TEXT("No Vaild Inventory"));
|
||||||
}
|
}
|
||||||
@ -690,6 +700,5 @@ void AEndlessVendettaCharacter::ExitShip(FTransform ExitLoc)
|
|||||||
SetActorLocation(ExitLoc.GetLocation());
|
SetActorLocation(ExitLoc.GetLocation());
|
||||||
GetController()->SetControlRotation(ExitLoc.Rotator());
|
GetController()->SetControlRotation(ExitLoc.Rotator());
|
||||||
SpaceShip->Destroy();
|
SpaceShip->Destroy();
|
||||||
PlayerOnShip = false;
|
PlayerOnShip = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@ UCLASS(config=Game)
|
|||||||
class AEndlessVendettaCharacter : public ACharacter
|
class AEndlessVendettaCharacter : public ACharacter
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Pawn mesh: 1st person view (arms; seen only by self) */
|
/** Pawn mesh: 1st person view (arms; seen only by self) */
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Mesh)
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Mesh)
|
||||||
USkeletalMeshComponent* Mesh1P;
|
USkeletalMeshComponent* Mesh1P;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** First person camera */
|
/** First person camera */
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
//STAMINA AND SPRINT SPEED
|
//STAMINA AND SPRINT SPEED
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
|
||||||
float MaxStamina = 100;
|
float MaxStamina = 100;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
|
||||||
float CurrentStamina;
|
float CurrentStamina;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
|
||||||
@ -118,6 +118,9 @@ public:
|
|||||||
bool bIsSecondaryWeaponCreated = false;
|
bool bIsSecondaryWeaponCreated = false;
|
||||||
bool bIsWeaponPickedUp = false;
|
bool bIsWeaponPickedUp = false;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadWrite)
|
||||||
|
bool bIsInDialogue = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
@ -217,7 +220,6 @@ protected:
|
|||||||
void Interact();
|
void Interact();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Used by vault it plugin to run vaulting animations
|
// Used by vault it plugin to run vaulting animations
|
||||||
USkeletalMeshComponent* FP_SkeletalMesh = nullptr;
|
USkeletalMeshComponent* FP_SkeletalMesh = nullptr;
|
||||||
|
|
||||||
@ -226,8 +228,6 @@ protected:
|
|||||||
// End of APawn interface
|
// End of APawn interface
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Stealth")
|
UFUNCTION(BlueprintCallable, Category = "Stealth")
|
||||||
void SetCrouch();
|
void SetCrouch();
|
||||||
UFUNCTION(BlueprintCallable, Category = "Stealth")
|
UFUNCTION(BlueprintCallable, Category = "Stealth")
|
||||||
@ -264,7 +264,8 @@ private:
|
|||||||
UPROPERTY(EditDefaultsOnly, Category = "Space Ship")
|
UPROPERTY(EditDefaultsOnly, Category = "Space Ship")
|
||||||
TSubclassOf<ASpaceShip> SpaceShipClass;
|
TSubclassOf<ASpaceShip> SpaceShipClass;
|
||||||
ASpaceShip* SpaceShip;
|
ASpaceShip* SpaceShip;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
void ExitShip(FTransform ExitLoc);
|
void ExitShip(FTransform ExitLoc);
|
||||||
void EnterShip(FTransform TakeoffLoc);
|
void EnterShip(FTransform TakeoffLoc);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user