public void DuplicateNodeConnecting(WorldDynamic currentState, PlanAction action, KeyValuePair <AgentStateStatic, AgentStateDynamic> agent, StoryNode currentNode, int globalNodeNumber, ref Queue <StoryNode> queue, bool succsessControl, ref bool skip) { StoryNode testNode = CreateTestNode(currentState, action, agent, currentNode, false, globalNodeNumber, succsessControl); testNode.UpdateHashCode(); if (!testNode.Equals(currentNode)) { foreach (var checkedNode in nodes) { if (TwoNodesComparison(testNode, checkedNode) && !currentNode.ConnectedWith(checkedNode)) { DeleteTestNode(ref testNode); ConnectionTwoNodes(action, currentNode, checkedNode, true); break; } } } else { DeleteTestNode(ref testNode); skip = true; } }
public bool DuplicateControl(WorldDynamic currentState, PlanAction action, StoryGraph currentGraph, KeyValuePair <AgentStateStatic, AgentStateDynamic> agent, StoryNode currentNode, int globalNodeNumber, bool succsessControl) { StoryNode testNode = currentGraph.CreateTestNode(currentState, action, agent, currentNode, false, globalNodeNumber, succsessControl); testNode.UpdateHashCode(); foreach (var checkedNode in currentGraph.GetNodes()) { checkedNode.UpdateHashCode(); if (currentGraph.TwoNodesComparison(testNode, checkedNode)) { currentGraph.DeleteTestNode(ref testNode); return(false); } } currentGraph.DeleteTestNode(ref testNode); return(true); }