Update Dialogue System for Changing Speaker
This commit is contained in:
parent
ad94db81c7
commit
2f1fe1c0ca
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)
Normal file
BIN
EndlessVendetta/Content/Dialogue/D_Mayor_Tutorial.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueTree.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/Dialogue/Testing/TestDialogueTree.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/Dialogue/test.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Dialogue/test.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/EnemyAITest/E/WM/7S8OEF1ALOX6NKI759UPUB.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/EnemyAITest/E/WM/7S8OEF1ALOX6NKI759UPUB.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -25,6 +25,21 @@ void UAC_PlayerDialogueInterpreter::BeginPlay()
|
||||
// ...
|
||||
}
|
||||
|
||||
FDialogueCharacter* UAC_PlayerDialogueInterpreter::GetCharacterSpeakingFromEnum(ECharacterSpeaking CharacterSpeakingEnum) const
|
||||
{
|
||||
switch (CharacterSpeakingEnum)
|
||||
{
|
||||
case ECharacterSpeaking::Character1:
|
||||
return &CurrentDialogueTree->Character1;
|
||||
case ECharacterSpeaking::Character2:
|
||||
return &CurrentDialogueTree->Character2;
|
||||
case ECharacterSpeaking::Character3:
|
||||
return &CurrentDialogueTree->Character3;
|
||||
case ECharacterSpeaking::Character4:
|
||||
return &CurrentDialogueTree->Character4;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void UAC_PlayerDialogueInterpreter::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
@ -38,6 +53,8 @@ void UAC_PlayerDialogueInterpreter::StartDialogue(UDialogueTree* DialogueTree)
|
||||
{
|
||||
CurrentDialogueTree = DialogueTree;
|
||||
CurrentTextNode = Cast<UDialogueTextNode>(DialogueTree->RootNodes[0]->ChildrenNodes[0]);
|
||||
if (!IsValid(CurrentTextNode)) return;
|
||||
CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking);
|
||||
OnStartDialogue.Broadcast(CurrentTextNode);
|
||||
|
||||
if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
|
||||
@ -66,6 +83,7 @@ void UAC_PlayerDialogueInterpreter::NextDialogue()
|
||||
else
|
||||
{
|
||||
CurrentTextNode = Cast<UDialogueTextNode>(CurrentTextNode->ChildrenNodes[0]);
|
||||
CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking);
|
||||
OnNextDialogue.Broadcast(CurrentTextNode);
|
||||
CurrentChoiceNode = nullptr;
|
||||
}
|
||||
@ -83,6 +101,7 @@ void UAC_PlayerDialogueInterpreter::MakeChoiceDialogue(const int Choice)
|
||||
else
|
||||
{
|
||||
CurrentTextNode = Cast<UDialogueTextNode>(CurrentChoiceNode->ChildrenNodes[Choice]);
|
||||
CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking);
|
||||
OnNextDialogue.Broadcast(CurrentTextNode);
|
||||
CurrentChoiceNode = nullptr;
|
||||
}
|
||||
@ -92,6 +111,7 @@ void UAC_PlayerDialogueInterpreter::EndDialogue()
|
||||
{
|
||||
CurrentChoiceNode = nullptr;
|
||||
CurrentTextNode = nullptr;
|
||||
CurrentCharacterSpeaking = FDialogueCharacter();
|
||||
OnEndDialogue.Broadcast();
|
||||
|
||||
if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Dialogue")
|
||||
UDialogueTree* CurrentDialogueTree;
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Dialogue")
|
||||
FDialogueCharacter CurrentCharacterSpeaking;
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
@ -47,6 +49,7 @@ private:
|
||||
UDialogueTextNode* CurrentTextNode;
|
||||
UPROPERTY()
|
||||
UDialogueChoiceNode* CurrentChoiceNode;
|
||||
FDialogueCharacter* GetCharacterSpeakingFromEnum(ECharacterSpeaking CharacterSpeakingEnum) const;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
|
@ -14,6 +14,11 @@ UDialogueChoiceNode::UDialogueChoiceNode()
|
||||
|
||||
#if WITH_EDITOR
|
||||
|
||||
FText UDialogueChoiceNode::GetNodeTitle() const
|
||||
{
|
||||
return NodeTitle.IsEmpty() ? LOCTEXT("Choice Node", "Choice Node") : NodeTitle;
|
||||
}
|
||||
|
||||
FLinearColor UDialogueChoiceNode::GetBackgroundColor() const
|
||||
{
|
||||
const UDialogueTree* DialogueTree = Cast<UDialogueTree>(GetGraph());
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
FString Choice3Text = "None";
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual FText GetNodeTitle() const override;
|
||||
virtual FLinearColor GetBackgroundColor() const override;
|
||||
#endif
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ 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);
|
||||
return FLinearColor(0.f, 1.f, 0.f, 1.f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -30,9 +30,7 @@ public:
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual FText GetNodeTitle() const override;
|
||||
|
||||
virtual void SetNodeTitle(const FText& NewTitle) override;
|
||||
|
||||
virtual FLinearColor GetBackgroundColor() const override;
|
||||
#endif
|
||||
};
|
||||
|
@ -12,9 +12,9 @@ struct FDialogueCharacter
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||
FName CharacterName;
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||
FLinearColor DialogueNodeBgColor;
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Dialogue")
|
||||
UTexture2D* DialogueCharacterPortrait;
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Node")
|
||||
FLinearColor DialogueNodeBgColor;
|
||||
};
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
|
Loading…
Reference in New Issue
Block a user