- ComboManagerComponent accepts a list of actions to unlock.
- Removed more unused functions.
This commit is contained in:
parent
64b2c8e934
commit
13172b3b60
@ -26,24 +26,6 @@ UComboActionGraph::UComboActionGraph()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UComboActionGraph::CanStartDialogueGraph() const
|
|
||||||
{
|
|
||||||
if (this->AllNodes.Num() == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const UComboActionGraphNode *Itr : this->AllNodes)
|
|
||||||
{
|
|
||||||
if (!Itr || !Itr->ValidateNodeRuntime())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UComboActionGraph::CreateGraph()
|
void UComboActionGraph::CreateGraph()
|
||||||
{
|
{
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
|
|||||||
@ -142,6 +142,8 @@ void UComboManagerComponent::ResetCombo()
|
|||||||
|
|
||||||
const UComboActionGraphNode *UComboManagerComponent::FindActiveNodeData(const UComboActionGraphNode *CurrentNode, const UComboInputAsset *Input, const EComboActionTriggerEvent TriggerEvent, const UComboAction *&ComboAction)
|
const UComboActionGraphNode *UComboManagerComponent::FindActiveNodeData(const UComboActionGraphNode *CurrentNode, const UComboInputAsset *Input, const EComboActionTriggerEvent TriggerEvent, const UComboAction *&ComboAction)
|
||||||
{
|
{
|
||||||
|
checkf(CurrentNode, TEXT("Attempting to find an active node from a null node."));
|
||||||
|
|
||||||
// Find a node that matches both the combo input and the trigger action.
|
// Find a node that matches both the combo input and the trigger action.
|
||||||
const UComboActionGraphNode *NextNode = nullptr;
|
const UComboActionGraphNode *NextNode = nullptr;
|
||||||
for (const UComboActionGraphNode *GraphNode : CurrentNode->ChildrenNodes)
|
for (const UComboActionGraphNode *GraphNode : CurrentNode->ChildrenNodes)
|
||||||
@ -150,10 +152,11 @@ const UComboActionGraphNode *UComboManagerComponent::FindActiveNodeData(const UC
|
|||||||
{
|
{
|
||||||
if (ActionNode->GetComboInput() == Input && ActionNode->GetTriggerEvent() == EComboActionTriggerEvent::Activated)
|
if (ActionNode->GetComboInput() == Input && ActionNode->GetTriggerEvent() == EComboActionTriggerEvent::Activated)
|
||||||
{
|
{
|
||||||
// If we found the right node, only acknowledge it if it's enabled. Otherwise just skip it.
|
// If we found the right node, only acknowledge it if it's enabled.
|
||||||
if (ActionNode->bEnabled)
|
const UComboAction *CheckAction = ActionNode->GetComboAction();
|
||||||
|
if (ActionNode->bEnabled || this->ComboGraph->UnlockedActions.Contains(CheckAction))
|
||||||
{
|
{
|
||||||
ComboAction = ActionNode->GetComboAction();
|
ComboAction = CheckAction;
|
||||||
NextNode = ActionNode;
|
NextNode = ActionNode;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -43,17 +43,17 @@ public:
|
|||||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||||
class UComboActionGraphNode *StartNode = nullptr;
|
class UComboActionGraphNode *StartNode = nullptr;
|
||||||
/**
|
/**
|
||||||
* The class of the dialogue node represented by this instance.
|
* The class of the action node represented by this instance.
|
||||||
*/
|
*/
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||||
TSubclassOf<UComboActionGraphNode> NodeType;
|
TSubclassOf<UComboActionGraphNode> NodeType;
|
||||||
/**
|
/**
|
||||||
* The class of the dialogue edge represented by this instance.
|
* The class of the action edge represented by this instance.
|
||||||
*/
|
*/
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||||
TSubclassOf<UComboActionGraphEdge> EdgeType;
|
TSubclassOf<UComboActionGraphEdge> EdgeType;
|
||||||
/**
|
/**
|
||||||
* An array of root nodes in the dialogue graph. These are the nodes that do not have any incoming connections.
|
* An array of root nodes in the action graph. These are the nodes that do not have any incoming connections.
|
||||||
*/
|
*/
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||||
TArray<UComboActionGraphNode*> RootNodes;
|
TArray<UComboActionGraphNode*> RootNodes;
|
||||||
@ -62,6 +62,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||||
TArray<UComboActionGraphNode*> AllNodes;
|
TArray<UComboActionGraphNode*> AllNodes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set containing actions to be unlocked if their associated nodes are currently locked.
|
||||||
|
*/
|
||||||
|
UPROPERTY(BlueprintReadWrite, Category="Combo Input|Action")
|
||||||
|
TSet<const class UComboAction*> UnlockedActions;
|
||||||
|
|
||||||
// Flag indicating whether an edge is enabled
|
// Flag indicating whether an edge is enabled
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||||
bool bEdgeEnabled;
|
bool bEdgeEnabled;
|
||||||
@ -88,18 +95,12 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
||||||
TArray<UComboActionGraphNode*> GetRootNodes() const { return this->RootNodes; }
|
TArray<UComboActionGraphNode*> GetRootNodes() const { return this->RootNodes; }
|
||||||
/**
|
/**
|
||||||
* Returns the root nodes of the dialogue graph.
|
* Returns the first node in the graph.
|
||||||
*
|
*
|
||||||
* @return An array of all root nodes.
|
* @return The start node of this graph.
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
||||||
UComboActionGraphNode *GetStartNode() const { return this->StartNode; }
|
UComboActionGraphNode *GetStartNode() const { return this->StartNode; }
|
||||||
/**
|
|
||||||
* Determines whether the dialogue graph can be started.
|
|
||||||
*
|
|
||||||
* @return true if the graph can be started, false otherwise.
|
|
||||||
*/
|
|
||||||
bool CanStartDialogueGraph() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void CreateGraph();
|
void CreateGraph();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user