add unity behavior package & examples

add behavior tree implementation
This commit is contained in:
2025-04-23 18:10:17 +02:00
parent 4602ff2416
commit a97b3be68a
34 changed files with 3675 additions and 92 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7c70600a28e03483cb56aa551aa37e4e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4cf66043983544bbc98e8ac8e12b9be0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b025019d3a5248dcbfd30e7f09a1037
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,642 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-8004916111235397541
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: db920e62f70f420bb33c771449926fa4, type: 3}
m_Name: FindPlayerByTagGraph
m_EditorClassIdentifier:
Graphs:
- rid: 9070097351736033641
RootGraph:
rid: 9070097351736033641
m_DebugInfo: {fileID: 2968163567394950048}
references:
version: 2
RefIds:
- rid: -2
type: {class: , ns: , asm: }
- rid: 9070097351736033641
type: {class: BehaviorGraphModule, ns: Unity.Behavior, asm: Unity.Behavior}
data:
AuthoringAssetID:
m_Value0: 8472638687165886343
m_Value1: 13090078971041952330
m_DebugInfo: {fileID: 0}
Root:
rid: 9070097351736033642
BlackboardReference:
rid: 9070097351736033643
BlackboardGroupReferences: []
m_ActiveNodes: []
m_NodesToTick: []
m_NodesToEnd:
rid: 9070097351736033644
m_EndedNodes:
rid: 9070097351736033645
m_VersionTimestamp: 638810238854352690
- rid: 9070097351736033642
type: {class: Start, ns: Unity.Behavior, asm: Unity.Behavior}
data:
ID:
m_Value0: 7336022054195250951
m_Value1: 4979159259301990765
Graph:
rid: 9070097351736033641
m_Parent:
rid: -2
m_Child:
rid: 9070097351736033646
Repeat: 1
AllowMultipleRepeatsPerTick: 0
- rid: 9070097351736033643
type: {class: BlackboardReference, ns: Unity.Behavior, asm: Unity.Behavior}
data:
m_Blackboard:
rid: 9070097351736033647
m_Source: {fileID: 1391842873379991656}
- rid: 9070097351736033644
type: {class: 'Stack`1[[Unity.Behavior.Node, Unity.Behavior]]', ns: System.Collections.Generic, asm: mscorlib}
data:
- rid: 9070097351736033645
type: {class: 'HashSet`1[[Unity.Behavior.Node, Unity.Behavior]]', ns: System.Collections.Generic, asm: System.Core}
data:
- rid: 9070097351736033646
type: {class: SequenceComposite, ns: Unity.Behavior, asm: Unity.Behavior}
data:
ID:
m_Value0: 9793252009228570053
m_Value1: 9479013914681626096
Graph:
rid: 9070097351736033641
m_Parent:
rid: 9070097351736033642
m_Children:
- rid: 9070097351736033648
- rid: 9070097351736033649
- rid: 9070097351736033647
type: {class: Blackboard, ns: Unity.Behavior, asm: Unity.Behavior}
data:
m_Variables:
- rid: 9070097351736033650
- rid: 9070097351736033651
- rid: 9070097351736033652
- rid: 9070097351736033648
type: {class: FindClosestWithTagAction, ns: Unity.Behavior, asm: Unity.Behavior}
data:
ID:
m_Value0: 9124962375273955539
m_Value1: 4661649367211639632
Graph:
rid: 9070097351736033641
m_Parent:
rid: 9070097351736033646
Target:
rid: 9070097351736033651
Agent:
rid: 9070097351736033650
Tag:
rid: 9070097351736033652
- rid: 9070097351736033649
type: {class: LogMessageToConsoleAction, ns: Unity.Behavior, asm: Unity.Behavior}
data:
ID:
m_Value0: 603879418173169765
m_Value1: 4864487925901392476
Graph:
rid: 9070097351736033641
m_Parent:
rid: 9070097351736033646
Message:
rid: 9070097351736033653
LogLevel:
rid: 9070097351736033654
- rid: 9070097351736033650
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 1
m_Value1: 0
Name: Self
m_Value: {fileID: 0}
- rid: 9070097351736033651
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 10214100403212403548
m_Value1: 13126355618884091446
Name: Target
m_Value: {fileID: 0}
- rid: 9070097351736033652
type: {class: 'BlackboardVariable`1[[System.String, mscorlib]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 5843045788723394570
m_Value1: 1999383720671562143
Name: Tag
m_Value: Player
- rid: 9070097351736033653
type: {class: 'BlackboardVariable`1[[System.String, mscorlib]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value: See Player
- rid: 9070097351736033654
type: {class: 'BlackboardVariable`1[[Unity.Behavior.LogMessageToConsoleAction/LogType, Unity.Behavior]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bad8f2220607dac4db5082ff333fafb8, type: 3}
m_Name: FindPlayerByTagGraph
m_EditorClassIdentifier:
Blackboard: {fileID: 681276063523936713}
m_Description:
m_Nodes:
- rid: 9070097351736033585
- rid: 9070097351736033596
- rid: 9070097351736033608
- rid: 9070097351736033629
m_VersionTimestamp: 638810238854352690
m_DebugInfo: {fileID: 2968163567394950048}
m_RuntimeGraph: {fileID: -8004916111235397541}
AssetID:
m_Value0: 8472638687165886343
m_Value1: 13090078971041952330
Story:
Story:
StoryVariableNames: []
Variables: []
m_NodeModelsInfo:
- Name: On Start
Story:
RuntimeTypeID:
m_Value0: 3335272451348827663
m_Value1: 11549843281177505721
Variables: []
NamedChildren: []
- Name: Sequence
Story:
RuntimeTypeID:
m_Value0: 10181448252506100447
m_Value1: 8737116843063128493
Variables: []
NamedChildren: []
- Name: Log Message
Story: Log [message] to the console
RuntimeTypeID:
m_Value0: 14362779694071371193
m_Value1: 7851297057022692581
Variables:
- Name: Message
Type:
m_SerializableType: System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
Tooltip:
- Name: LogLevel
Type:
m_SerializableType: Unity.Behavior.LogMessageToConsoleAction+LogType, Unity.Behavior,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Tooltip:
NamedChildren: []
- Name: Find Closest With Tag
Story: 'Find [Target] closest to [Agent] with tag: [Tag]'
RuntimeTypeID:
m_Value0: 1272391661889856870
m_Value1: 10362915794162135082
Variables:
- Name: Target
Type:
m_SerializableType: UnityEngine.GameObject, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
Tooltip:
- Name: Agent
Type:
m_SerializableType: UnityEngine.GameObject, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
Tooltip:
- Name: Tag
Type:
m_SerializableType: System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
Tooltip:
NamedChildren: []
m_Blackboards: []
m_MainBlackboardAuthoringAsset: {fileID: 681276063523936713}
m_CommandBuffer:
m_Commands: []
m_SubgraphsInfo: []
references:
version: 2
RefIds:
- rid: -2
type: {class: , ns: , asm: }
- rid: 9070097351736033585
type: {class: StartNodeModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
Position: {x: 0, y: 0}
ID:
m_Value0: 7336022054195250951
m_Value1: 4979159259301990765
Parents: []
PortModels:
- rid: 9070097351736033586
NodeType:
m_SerializableType: Unity.Behavior.Start, Unity.Behavior, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
NodeTypeID:
m_Value0: 3335272451348827663
m_Value1: 11549843281177505721
m_FieldValues: []
Repeat: 1
AllowMultipleRepeatsPerTick: 0
- rid: 9070097351736033586
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: OutputPort
m_PortDataFlowType: 1
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033585
m_Connections:
- rid: 9070097351736033597
- rid: 9070097351736033596
type: {class: CompositeNodeModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
Position: {x: 0, y: 103}
ID:
m_Value0: 9793252009228570053
m_Value1: 9479013914681626096
Parents: []
PortModels:
- rid: 9070097351736033597
- rid: 9070097351736033598
NodeType:
m_SerializableType: Unity.Behavior.SequenceComposite, Unity.Behavior, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
NodeTypeID:
m_Value0: 10181448252506100447
m_Value1: 8737116843063128493
m_FieldValues: []
- rid: 9070097351736033597
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: InputPort
m_PortDataFlowType: 0
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033596
m_Connections:
- rid: 9070097351736033586
- rid: 9070097351736033598
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: OutputPort
m_PortDataFlowType: 1
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033596
m_Connections:
- rid: 9070097351736033609
- rid: 9070097351736033630
- rid: 9070097351736033608
type: {class: ActionNodeModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
Position: {x: 145, y: 191}
ID:
m_Value0: 603879418173169765
m_Value1: 4864487925901392476
Parents: []
PortModels:
- rid: 9070097351736033609
- rid: 9070097351736033610
NodeType:
m_SerializableType: Unity.Behavior.LogMessageToConsoleAction, Unity.Behavior,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NodeTypeID:
m_Value0: 14362779694071371193
m_Value1: 7851297057022692581
m_FieldValues:
- rid: 9070097351736033611
- rid: 9070097351736033612
- rid: 9070097351736033609
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: InputPort
m_PortDataFlowType: 0
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033608
m_Connections:
- rid: 9070097351736033598
- rid: 9070097351736033610
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: OutputPort
m_PortDataFlowType: 1
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033608
m_Connections: []
- rid: 9070097351736033611
type: {class: BehaviorGraphNodeModel/FieldModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
FieldName: Message
Type:
m_SerializableType: System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
LocalValue:
rid: 9070097351736033613
LinkedVariable:
rid: -2
- rid: 9070097351736033612
type: {class: BehaviorGraphNodeModel/FieldModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
FieldName: LogLevel
Type:
m_SerializableType: Unity.Behavior.LogMessageToConsoleAction+LogType, Unity.Behavior,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
LocalValue:
rid: 9070097351736033614
LinkedVariable:
rid: -2
- rid: 9070097351736033613
type: {class: 'BlackboardVariable`1[[System.String, mscorlib]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value: See Player
- rid: 9070097351736033614
type: {class: 'BlackboardVariable`1[[Unity.Behavior.LogMessageToConsoleAction/LogType, Unity.Behavior]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value: 0
- rid: 9070097351736033629
type: {class: ActionNodeModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
Position: {x: -131, y: 191}
ID:
m_Value0: 9124962375273955539
m_Value1: 4661649367211639632
Parents: []
PortModels:
- rid: 9070097351736033630
- rid: 9070097351736033631
NodeType:
m_SerializableType: Unity.Behavior.FindClosestWithTagAction, Unity.Behavior,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NodeTypeID:
m_Value0: 1272391661889856870
m_Value1: 10362915794162135082
m_FieldValues:
- rid: 9070097351736033632
- rid: 9070097351736033633
- rid: 9070097351736033634
- rid: 9070097351736033630
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: InputPort
m_PortDataFlowType: 0
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033629
m_Connections:
- rid: 9070097351736033598
- rid: 9070097351736033631
type: {class: PortModel, ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
m_Name: OutputPort
m_PortDataFlowType: 1
m_IsFloating: 0
m_NodeModel:
rid: 9070097351736033629
m_Connections: []
- rid: 9070097351736033632
type: {class: BehaviorGraphNodeModel/FieldModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
FieldName: Target
Type:
m_SerializableType: UnityEngine.GameObject, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
LocalValue:
rid: 9070097351736033635
LinkedVariable:
rid: 9070097351736033636
- rid: 9070097351736033633
type: {class: BehaviorGraphNodeModel/FieldModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
FieldName: Agent
Type:
m_SerializableType: UnityEngine.GameObject, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
LocalValue:
rid: 9070097351736033637
LinkedVariable:
rid: 9070097351736033640
- rid: 9070097351736033634
type: {class: BehaviorGraphNodeModel/FieldModel, ns: Unity.Behavior, asm: Unity.Behavior.Authoring}
data:
FieldName: Tag
Type:
m_SerializableType: System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
LocalValue:
rid: 9070097351736033638
LinkedVariable:
rid: 9070097351736033639
- rid: 9070097351736033635
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value: {fileID: 0}
- rid: 9070097351736033636
type: {class: 'TypedVariableModel`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
ID:
m_Value0: 10214100403212403548
m_Value1: 13126355618884091446
Name: Target
IsExposed: 0
m_IsShared: 0
m_Value: {fileID: 0}
- rid: 9070097351736033637
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value: {fileID: 0}
- rid: 9070097351736033638
type: {class: 'BlackboardVariable`1[[System.String, mscorlib]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 0
m_Value1: 0
Name:
m_Value:
- rid: 9070097351736033639
type: {class: 'TypedVariableModel`1[[System.String, mscorlib]]', ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
ID:
m_Value0: 5843045788723394570
m_Value1: 1999383720671562143
Name: Tag
IsExposed: 1
m_IsShared: 0
m_Value: Player
- rid: 9070097351736033640
type: {class: 'TypedVariableModel`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
ID:
m_Value0: 1
m_Value1: 0
Name: Self
IsExposed: 1
m_IsShared: 0
m_Value: {fileID: 0}
--- !u!114 &681276063523936713
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2dd922ae02c94c87a66e46a10a7319b9, type: 3}
m_Name: FindPlayerByTagGraph Blackboard
m_EditorClassIdentifier:
AssetID:
m_Value0: 0
m_Value1: 0
m_Variables:
- rid: 9070097351736033587
- rid: 9070097351736033617
- rid: 9070097351736033628
m_VersionTimestamp: 638810238579212790
m_CommandBuffer:
m_Commands: []
m_RuntimeBlackboardAsset: {fileID: 1391842873379991656}
references:
version: 2
RefIds:
- rid: 9070097351736033587
type: {class: 'TypedVariableModel`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
ID:
m_Value0: 1
m_Value1: 0
Name: Self
IsExposed: 1
m_IsShared: 0
m_Value: {fileID: 0}
- rid: 9070097351736033617
type: {class: 'TypedVariableModel`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
ID:
m_Value0: 10214100403212403548
m_Value1: 13126355618884091446
Name: Target
IsExposed: 0
m_IsShared: 0
m_Value: {fileID: 0}
- rid: 9070097351736033628
type: {class: 'TypedVariableModel`1[[System.String, mscorlib]]', ns: Unity.Behavior.GraphFramework, asm: Unity.Behavior.GraphFramework}
data:
ID:
m_Value0: 5843045788723394570
m_Value1: 1999383720671562143
Name: Tag
IsExposed: 1
m_IsShared: 0
m_Value: Player
--- !u!114 &1391842873379991656
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5c02bb70996b49eba31d0c206e28da24, type: 3}
m_Name: FindPlayerByTagGraph Blackboard
m_EditorClassIdentifier:
VersionTimestamp: 638810238579212790
AssetID:
m_Value0: 0
m_Value1: 0
m_Blackboard:
m_Variables:
- rid: 9070097351736033595
- rid: 9070097351736033655
- rid: 9070097351736033656
m_SharedBlackboardVariableGuids: []
references:
version: 2
RefIds:
- rid: 9070097351736033595
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 1
m_Value1: 0
Name: Self
m_Value: {fileID: 0}
- rid: 9070097351736033655
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 10214100403212403548
m_Value1: 13126355618884091446
Name: Target
m_Value: {fileID: 0}
- rid: 9070097351736033656
type: {class: 'BlackboardVariable`1[[System.String, mscorlib]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 5843045788723394570
m_Value1: 1999383720671562143
Name: Tag
m_Value: Player
--- !u!114 &2968163567394950048
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5b27bb6d9a2c8d540a10dff10acc543e, type: 3}
m_Name: FindPlayerByTagGraph Debug Info
m_EditorClassIdentifier:
m_CodeBreakPointsList: []
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 872fc1fafedb94754a32c44e784da9b5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+44 -2
View File
@@ -240,9 +240,10 @@ GameObject:
- component: {fileID: 213896440}
- component: {fileID: 213896439}
- component: {fileID: 213896438}
- component: {fileID: 213896442}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@@ -338,6 +339,18 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &213896442
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 213896437}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0e084138a20b47b4aef9bbf9e40bf53f, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &330585543
GameObject:
m_ObjectHideFlags: 0
@@ -712,6 +725,7 @@ GameObject:
- component: {fileID: 963271985}
- component: {fileID: 963271984}
- component: {fileID: 963271983}
- component: {fileID: 963271988}
m_Layer: 0
m_Name: Enemy
m_TagString: Untagged
@@ -726,7 +740,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963271982}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 99c993fa1e7746fa8c1f19ca160390c5, type: 3}
m_Name:
@@ -823,6 +837,34 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &963271988
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963271982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f0038c16c34866b4f9e25c9c0dc0f7e6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Graph: {fileID: 6532288503853721430, guid: 9b025019d3a5248dcbfd30e7f09a1037, type: 2}
m_BlackboardVariableOverridesList:
- rid: 9070097351736033657
m_IsInitialised: 0
m_IsStarted: 0
references:
version: 2
RefIds:
- rid: 9070097351736033657
type: {class: 'BlackboardVariable`1[[UnityEngine.GameObject, UnityEngine.CoreModule]]', ns: Unity.Behavior, asm: Unity.Behavior}
data:
GUID:
m_Value0: 1
m_Value1: 0
Name: Self
m_Value: {fileID: 963271982}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0e73928b0a104233917799d1897dd859
timeCreated: 1745423479
+10
View File
@@ -0,0 +1,10 @@
namespace DefaultNamespace.BehaviorTree
{
public abstract class Action : Node
{
public Action()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cc1cb3b6c7d74fc28fd7b6399bd09156
timeCreated: 1745423851
@@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace DefaultNamespace.BehaviorTree
{
public abstract class Composite : Node
{
public Composite(List<Node> nodes)
{
_nodes.AddRange(nodes);
}
public Composite(params Node[] nodes)
{
_nodes.AddRange(nodes);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 137c1749ac9748599a82996a6a005d54
timeCreated: 1745423923
@@ -0,0 +1,7 @@
namespace DefaultNamespace.BehaviorTree
{
public abstract class Condition : Action
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bfc01cdaf36045d3be75ac78fc1f0feb
timeCreated: 1745424014
@@ -0,0 +1,10 @@
namespace DefaultNamespace.BehaviorTree
{
public class Decorator : Node
{
public Decorator(Node node)
{
_nodes.Add(node);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8c98374aeec84c929927512d23f6631f
timeCreated: 1745423985
+31
View File
@@ -0,0 +1,31 @@
using System.Collections.Generic;
namespace DefaultNamespace.BehaviorTree
{
public abstract class Node
{
protected List<Node> _nodes = new ();
public virtual void Start()
{
}
public virtual Status Update()
{
return Status.Failure;
}
public virtual void End()
{
}
}
public enum Status
{
Success,
Failure,
Running,
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 086671579f914f31839c05dbdc541e33
timeCreated: 1745423564
@@ -0,0 +1,42 @@
using System;
namespace DefaultNamespace.BehaviorTree
{
public class Sequence : Composite
{
private int _currentIndex;
private Node _currentNode;
public override void Start()
{
_currentIndex = 0;
_currentNode = _nodes == null || _nodes.Count == 0 ? null : _nodes[_currentIndex];
_currentNode?.Start();
}
public override Status Update()
{
if (_currentNode == null) return Status.Failure;
Status status = _currentNode.Update();
switch (status)
{
case Status.Success:
_currentIndex++;
_currentNode.End();
if (_currentIndex >= _nodes.Count) return Status.Success;
_currentNode = _nodes[_currentIndex];
_currentNode?.Start();
return Status.Running;
case Status.Failure:
return Status.Failure;
case Status.Running:
return Status.Running;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 817cdc9a926641068ccf01671393272d
timeCreated: 1745424048
+25
View File
@@ -0,0 +1,25 @@
using System;
using UnityEngine;
namespace DefaultNamespace.BehaviorTree
{
public class Tree : MonoBehaviour
{
private Node _rootNode;
private void OnEnable()
{
_rootNode?.Start();
}
private void Update()
{
_rootNode?.Update();
}
private void OnDisable()
{
_rootNode?.End();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d2cbbd082c73432ca7bc1d76ac315ebe
timeCreated: 1745423498
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 90aacf97469f84a1ba368dd1edaf400d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
using System;
using DefaultNamespace;
using DefaultNamespace.FSM;
using Unity.Behavior;
using UnityEngine;
using Action = Unity.Behavior.Action;
using Unity.Properties;
[Serializable, GeneratePropertyBag]
[NodeDescription(name: "Find Player Controller By Raycast", story: "Find [Target] by Raycast from [Agent]", category: "Action/Find", id: "e2b3bc47cdb71b5678009c1d431fc68b")]
public partial class FindPlayerControllerByRaycastAction : Action
{
[SerializeReference] public BlackboardVariable<GameObject> Target;
[SerializeReference] public BlackboardVariable<GameObject> Agent;
[SerializeReference] public BlackboardVariable<float> MaxDistance = new(100);
protected override Status OnStart()
{
// setup node
// Target.Value = null;
// check initial values
if (Agent.Value == null) return Status.Failure;
return Status.Running;
}
protected override Status OnUpdate()
{
if (Physics.Raycast(Agent.Value.transform.position, Agent.Value.transform.forward, out RaycastHit hit,
MaxDistance))
{
if (hit.transform.GetComponent<PlayerController>() != null)
{
Target.Value = hit.transform.gameObject;
return Status.Success;
}
}
Target.Value = null;
return Status.Failure;
}
protected override void OnEnd()
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6a08b2b3e631346b2b155982df199f9a
@@ -0,0 +1,24 @@
using System;
using Unity.Behavior;
using UnityEngine;
[Serializable, Unity.Properties.GeneratePropertyBag]
[Condition(name: "GameObject is Null", story: "[Object] is [IsNull] null", category: "Variable Conditions", id: "9be617c0444353affee2f412e94ae715")]
public partial class GameObjectNullCondition : Condition
{
[SerializeReference] public BlackboardVariable<GameObject> Object;
[SerializeReference] public BlackboardVariable<bool> IsNull;
public override bool IsTrue()
{
return (Object.Value == null && IsNull) || (Object.Value != null && !IsNull);
}
public override void OnStart()
{
}
public override void OnEnd()
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 534847d817af848138303989d8adde9b