更新节点的可移动性

This commit is contained in:
997146918 2025-09-24 13:59:27 +08:00
parent 670905633d
commit a64ef3a90e
11 changed files with 29 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"BuildId": "37670630", "BuildId": "37670630",
"Modules": "Modules":
{ {
"ProjectFish": "UnrealEditor-ProjectFish-0003.dll", "ProjectFish": "UnrealEditor-ProjectFish.dll",
"ProjectFishEditor": "UnrealEditor-ProjectFishEditor-0003.dll" "ProjectFishEditor": "UnrealEditor-ProjectFishEditor.dll"
} }
} }

View File

@ -90,6 +90,10 @@ void UFishingMapSubSystem::MoveToNode(FGuid NodeID)
//节点不在可移动的列表内,更新状态 //节点不在可移动的列表内,更新状态
OnNodeStateChange.Broadcast(node->NodeID, EMapNodeState::Immovable); OnNodeStateChange.Broadcast(node->NodeID, EMapNodeState::Immovable);
} }
else
{
OnNodeStateChange.Broadcast(node->NodeID, EMapNodeState::Moveable);
}
} }
//根据节点类型 触发不同的事件 //根据节点类型 触发不同的事件
UFishingMapNode* node = GetNode(NodeID); UFishingMapNode* node = GetNode(NodeID);
@ -117,6 +121,27 @@ void UFishingMapSubSystem::MoveToNode(FGuid NodeID)
} }
} }
bool UFishingMapSubSystem::MoveToAble(FGuid TargetNodeID)
{
UFishingMapNode* currentNode = GetNode(PlayerPosNodeID);
UFishingMapNode* targetNode = GetNode(TargetNodeID);
if (currentNode)
{
for (auto connection: AllConnections)
{
if (connection.FromNodeID == PlayerPosNodeID && connection.ToNodeID == TargetNodeID)
{
return true;;
}
}
}
else
{
return targetNode->NodeState == EMapNodeState::Moveable;
}
return false;
}
void UFishingMapSubSystem::GenerateNodes() void UFishingMapSubSystem::GenerateNodes()
{ {

View File

@ -91,6 +91,8 @@ public:
UFUNCTION(BlueprintCallable, Category = "FishingMap") UFUNCTION(BlueprintCallable, Category = "FishingMap")
void MoveToNode(FGuid NodeID); void MoveToNode(FGuid NodeID);
UFUNCTION(BlueprintPure, Category = "FishingMap")
bool MoveToAble(FGuid TargetNodeID);
private: private:
void GetAllConnectedNodes(FGuid NodeID, TArray<FGuid>& ConnectedNodes); void GetAllConnectedNodes(FGuid NodeID, TArray<FGuid>& ConnectedNodes);