- 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
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
#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)
|
||||
{
|
||||
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.
|
||||
const UComboActionGraphNode *NextNode = nullptr;
|
||||
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 we found the right node, only acknowledge it if it's enabled. Otherwise just skip it.
|
||||
if (ActionNode->bEnabled)
|
||||
// If we found the right node, only acknowledge it if it's enabled.
|
||||
const UComboAction *CheckAction = ActionNode->GetComboAction();
|
||||
if (ActionNode->bEnabled || this->ComboGraph->UnlockedActions.Contains(CheckAction))
|
||||
{
|
||||
ComboAction = ActionNode->GetComboAction();
|
||||
ComboAction = CheckAction;
|
||||
NextNode = ActionNode;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -43,17 +43,17 @@ public:
|
||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||
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")
|
||||
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")
|
||||
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")
|
||||
TArray<UComboActionGraphNode*> RootNodes;
|
||||
@ -62,6 +62,13 @@ public:
|
||||
*/
|
||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||
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
|
||||
UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action")
|
||||
bool bEdgeEnabled;
|
||||
@ -88,18 +95,12 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category="Combo Input|Action")
|
||||
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")
|
||||
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:
|
||||
void CreateGraph();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user