Skip to content

Commit fb4fcb2

Browse files
committed
Refactored AI runtime executors to handle cancellation, added IsLooping input in EndNode, upgraded Unity packages and editor version.
1 parent 76aca5c commit fb4fcb2

17 files changed

Lines changed: 464 additions & 343 deletions

Assets/Examples/WaitingLine/WaitingLine.unity

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ GameObject:
128128
serializedVersion: 6
129129
m_Component:
130130
- component: {fileID: 61220059}
131-
- component: {fileID: 61220060}
132131
m_Layer: 0
133132
m_Name: destination
134133
m_TagString: Untagged
@@ -151,19 +150,6 @@ Transform:
151150
m_Children: []
152151
m_Father: {fileID: 0}
153152
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
154-
--- !u!114 &61220060
155-
MonoBehaviour:
156-
m_ObjectHideFlags: 0
157-
m_CorrespondingSourceObject: {fileID: 0}
158-
m_PrefabInstance: {fileID: 0}
159-
m_PrefabAsset: {fileID: 0}
160-
m_GameObject: {fileID: 61220058}
161-
m_Enabled: 1
162-
m_EditorHideFlags: 0
163-
m_Script: {fileID: 11500000, guid: b86c33df8db042a29390d78ee67af21a, type: 3}
164-
m_Name:
165-
m_EditorClassIdentifier: Assembly-CSharp::AITarget
166-
uuid: target
167153
--- !u!1 &61507270
168154
GameObject:
169155
m_ObjectHideFlags: 0
@@ -1704,7 +1690,6 @@ GameObject:
17041690
- component: {fileID: 1558606851}
17051691
- component: {fileID: 1558606853}
17061692
- component: {fileID: 1558606852}
1707-
- component: {fileID: 1558606854}
17081693
- component: {fileID: 1558606855}
17091694
- component: {fileID: 1558606856}
17101695
m_Layer: 0
@@ -1741,7 +1726,7 @@ MonoBehaviour:
17411726
m_Script: {fileID: 11500000, guid: 71270b33c2b259946b293ec36e4caeb3, type: 3}
17421727
m_Name:
17431728
m_EditorClassIdentifier: Assembly-CSharp::AI.GraphExecutor
1744-
runtimeGraph: {fileID: 11400000, guid: cca4049d69cbab64db1aebaf78b64848, type: 2}
1729+
runtimeGraph: {fileID: 11400000, guid: 56caeb73ca155ff41b92d19941dd20cf, type: 2}
17451730
--- !u!23 &1558606852
17461731
MeshRenderer:
17471732
m_ObjectHideFlags: 0
@@ -1798,19 +1783,6 @@ MeshFilter:
17981783
m_PrefabAsset: {fileID: 0}
17991784
m_GameObject: {fileID: 1558606848}
18001785
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
1801-
--- !u!114 &1558606854
1802-
MonoBehaviour:
1803-
m_ObjectHideFlags: 0
1804-
m_CorrespondingSourceObject: {fileID: 0}
1805-
m_PrefabInstance: {fileID: 0}
1806-
m_PrefabAsset: {fileID: 0}
1807-
m_GameObject: {fileID: 1558606848}
1808-
m_Enabled: 1
1809-
m_EditorHideFlags: 0
1810-
m_Script: {fileID: 11500000, guid: b86c33df8db042a29390d78ee67af21a, type: 3}
1811-
m_Name:
1812-
m_EditorClassIdentifier: Assembly-CSharp::AITarget
1813-
uuid: agent
18141786
--- !u!195 &1558606855
18151787
NavMeshAgent:
18161788
m_ObjectHideFlags: 0

Assets/Scripts/Editor/FlowNoddles/EndNode.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Editor.FlowNoddles {
1010
public class EndNode : BaseNode {
1111
protected override void OnDefinePorts(IPortDefinitionContext context) {
1212
context.AddInputPort<bool>("DestroyYourself").Build();
13+
context.AddInputPort<bool>("IsLooping").Build();
1314

1415
context.AddInputPort<bool>("TriggerIn").Build();
1516
}
@@ -20,13 +21,19 @@ public override AiBlockExecutor ConvertToExecutor(AiRuntimeGraph aiRuntimeGraph)
2021
executor.name = typeof(EndBlockExecutor).ToString();
2122

2223
var destroyUuidNode = (BoolVariableNode)GetInputPortByName("DestroyYourself").firstConnectedPort.GetNode();
24+
var isLoopingUuidNode = (BoolVariableNode)GetInputPortByName("IsLooping").firstConnectedPort.GetNode();
2325

2426
destroyUuidNode.GetNodeOptionByName("uuid").TryGetValue(value: out string destroyUuid);
2527
destroyUuidNode.GetNodeOptionByName("value").TryGetValue(value: out bool destroyUuidValue);
2628

29+
isLoopingUuidNode.GetNodeOptionByName("uuid").TryGetValue(value: out string isLoopingUuid);
30+
isLoopingUuidNode.GetNodeOptionByName("value").TryGetValue(value: out bool isLoopingValue);
31+
2732
executor.destroyYourselfUuid = destroyUuid;
33+
executor.isLoopingUuid = isLoopingUuid;
2834

2935
aiRuntimeGraph.boolData.TryAdd(destroyUuid, destroyUuidValue);
36+
aiRuntimeGraph.boolData.TryAdd(isLoopingUuid, isLoopingValue);
3037

3138
return executor;
3239
}

0 commit comments

Comments
 (0)