diff --git a/Assets/Data/Behaviour Trees/AnimatedEnemy.asset b/Assets/Data/Behaviour Trees/AnimatedEnemy.asset index d2210b31..ab3b2065 100644 --- a/Assets/Data/Behaviour Trees/AnimatedEnemy.asset +++ b/Assets/Data/Behaviour Trees/AnimatedEnemy.asset @@ -41,6 +41,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -59,6 +60,7 @@ MonoBehaviour: property: propertyType: 4 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -72,6 +74,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 0.1 @@ -85,6 +88,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -103,6 +107,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -116,6 +121,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 0.1 @@ -129,6 +135,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 0.8 diff --git a/Assets/Data/Behaviour Trees/ExampleNPC.asset b/Assets/Data/Behaviour Trees/ExampleNPC.asset new file mode 100644 index 00000000..2f458b2d --- /dev/null +++ b/Assets/Data/Behaviour Trees/ExampleNPC.asset @@ -0,0 +1,396 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !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: 54fb5e73c80040247a00b01917c6e426, type: 3} + m_Name: ExampleNPC + m_EditorClassIdentifier: + tree: + serializedNodes: + - childCount: 1 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 1 + - childCount: 2 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SelectorNode + firstChildIndex: 2 + - childCount: 4 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 3 + - childCount: 0 + element: + propertyInfo: + - name: property-name + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.HasPropertyNode + firstChildIndex: 4 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+CompareType, Assembly-CSharp, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 2 + aType: 0 + - name: operator + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+OperatorType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: source-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: comparator + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 1 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.CompareNode + firstChildIndex: 5 + - childCount: 0 + element: + propertyInfo: + - name: idle-duration + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 3 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.IdleNode + firstChildIndex: 6 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.SetPropertyNode+ValueType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 2 + aType: 0 + - name: target-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: property-value + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetPropertyNode + firstChildIndex: 7 + - childCount: 4 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 8 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.ArrayIteratorNode+ValueType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 4 + aType: 0 + - name: value-array + property: + propertyType: 5 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: + - propertyType: 4 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: -3, y: -3} + - propertyType: 4 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: -5, y: -5} + - propertyType: 4 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: -3, y: -5} + e: 0 + aType: 4 + - name: index-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-idx + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: value-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.ArrayIteratorNode + firstChildIndex: 9 + - childCount: 0 + element: + propertyInfo: + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: stop-distance + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0.2 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: move-speed + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 1.5 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SimpleMoveNode + firstChildIndex: 10 + - childCount: 0 + element: + propertyInfo: + - name: index-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-idx + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: array-length + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 3 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.ArrayIncrementNode + firstChildIndex: 11 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.SetPropertyNode+ValueType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 2 + aType: 0 + - name: target-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: property-value + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 1 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetPropertyNode + firstChildIndex: 12 diff --git a/Assets/Data/Behaviour Trees/SetupSneekoTree.asset.meta b/Assets/Data/Behaviour Trees/ExampleNPC.asset.meta similarity index 79% rename from Assets/Data/Behaviour Trees/SetupSneekoTree.asset.meta rename to Assets/Data/Behaviour Trees/ExampleNPC.asset.meta index c23a5777..c3eae896 100644 --- a/Assets/Data/Behaviour Trees/SetupSneekoTree.asset.meta +++ b/Assets/Data/Behaviour Trees/ExampleNPC.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 64a6070144d65fb4a86a0493bb5d72a7 +guid: de69ac2176667774d94e83467a58ecce NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Data/Behaviour Trees/JimmyBehaviour.asset b/Assets/Data/Behaviour Trees/JimmyBehaviour.asset new file mode 100644 index 00000000..cd7882ce --- /dev/null +++ b/Assets/Data/Behaviour Trees/JimmyBehaviour.asset @@ -0,0 +1,819 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !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: 54fb5e73c80040247a00b01917c6e426, type: 3} + m_Name: JimmyBehaviour + m_EditorClassIdentifier: + tree: + serializedNodes: + - childCount: 1 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 1 + - childCount: 3 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SelectorNode + firstChildIndex: 2 + - childCount: 5 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 3 + - childCount: 0 + element: + propertyInfo: + - name: object-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: self + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.GetSelfNode + firstChildIndex: 4 + - childCount: 0 + element: + propertyInfo: + - name: source-npc + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: self + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.IsEnemyNode + firstChildIndex: 5 + - childCount: 0 + element: + propertyInfo: + - name: tag-name + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: Player + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: actor-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.FindActorByTagNode + firstChildIndex: 6 + - childCount: 0 + element: + propertyInfo: + - name: actor-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: position-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.GetActorPositionNode + firstChildIndex: 7 + - childCount: 3 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SelectorNode + firstChildIndex: 8 + - childCount: 4 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 9 + - childCount: 0 + element: + propertyInfo: + - name: property-name + property: + propertyType: 6 + objectType: RPG.PropertyName, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 1 + aType: 0 + - name: property-type + property: + propertyType: 6 + objectType: RPG.PropertyType, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: property-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: health + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.GetEntityPropertyNode + firstChildIndex: 10 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+CompareType, Assembly-CSharp, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: operator + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+OperatorType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 1 + aType: 0 + - name: source-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: health + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: comparator + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 4 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.CompareNode + firstChildIndex: 11 + - childCount: 0 + element: + propertyInfo: + - name: source-npc + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: self + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: is-enemy + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetEnemyNode + firstChildIndex: 12 + - childCount: 0 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.ForceDialogueNode + firstChildIndex: 13 + - childCount: 3 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 14 + - childCount: 0 + element: + propertyInfo: + - name: range + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 1.2 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.RangeCheckNode + firstChildIndex: 15 + - childCount: 0 + element: + propertyInfo: + - name: target-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetActionTargetNode + firstChildIndex: 16 + - childCount: 0 + element: + propertyInfo: + - name: action-index + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.InvokeActionNode + firstChildIndex: 17 + - childCount: 2 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 18 + - childCount: 0 + element: + propertyInfo: + - name: range + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 4 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.RangeCheckNode + firstChildIndex: 19 + - childCount: 0 + element: + propertyInfo: + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: player-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: stop-distance + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 1.2 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: move-speed + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 1.5 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SimpleMoveNode + firstChildIndex: 20 + - childCount: 4 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 21 + - childCount: 0 + element: + propertyInfo: + - name: property-name + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.HasPropertyNode + firstChildIndex: 22 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+CompareType, Assembly-CSharp, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 2 + aType: 0 + - name: operator + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+OperatorType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: source-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: comparator + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 1 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.CompareNode + firstChildIndex: 23 + - childCount: 0 + element: + propertyInfo: + - name: idle-duration + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 2 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.IdleNode + firstChildIndex: 24 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.SetPropertyNode+ValueType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 2 + aType: 0 + - name: target-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: property-value + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetPropertyNode + firstChildIndex: 25 + - childCount: 4 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 26 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.ArrayIteratorNode+ValueType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 4 + aType: 0 + - name: value-array + property: + propertyType: 5 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: + - propertyType: 4 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: -8, y: -0.3} + - propertyType: 4 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: -3, y: -0.3} + e: 0 + aType: 4 + - name: index-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-idx + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: value-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.ArrayIteratorNode + firstChildIndex: 27 + - childCount: 0 + element: + propertyInfo: + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-pos + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: stop-distance + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0.1 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: move-speed + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 1 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SimpleMoveNode + firstChildIndex: 28 + - childCount: 0 + element: + propertyInfo: + - name: index-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: patrol-idx + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: array-length + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 2 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.ArrayIncrementNode + firstChildIndex: 29 + - childCount: 0 + element: + propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.SetPropertyNode+ValueType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 2 + aType: 0 + - name: target-property + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: idle + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: property-value + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 1 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetPropertyNode + firstChildIndex: 30 diff --git a/Assets/Data/Behaviour Trees/JimmyBehaviour.asset.meta b/Assets/Data/Behaviour Trees/JimmyBehaviour.asset.meta new file mode 100644 index 00000000..1a228fad --- /dev/null +++ b/Assets/Data/Behaviour Trees/JimmyBehaviour.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8bd8b783c74999f44b82c57c7c59c5f6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Behaviour Trees/JimmyFightTrigger.asset b/Assets/Data/Behaviour Trees/JimmyFightTrigger.asset new file mode 100644 index 00000000..6ad70a6a --- /dev/null +++ b/Assets/Data/Behaviour Trees/JimmyFightTrigger.asset @@ -0,0 +1,73 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !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: 54fb5e73c80040247a00b01917c6e426, type: 3} + m_Name: JimmyFightTrigger + m_EditorClassIdentifier: + tree: + serializedNodes: + - childCount: 2 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 1 + - childCount: 0 + element: + propertyInfo: + - name: object-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: self + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.GetSelfNode + firstChildIndex: 2 + - childCount: 0 + element: + propertyInfo: + - name: source-npc + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: self + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: is-enemy + property: + propertyType: 0 + objectType: + forceReserialization: 0 + value: + b: 1 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SetEnemyNode + firstChildIndex: 3 diff --git a/Assets/Data/Behaviour Trees/JimmyFightTrigger.asset.meta b/Assets/Data/Behaviour Trees/JimmyFightTrigger.asset.meta new file mode 100644 index 00000000..80d81d4b --- /dev/null +++ b/Assets/Data/Behaviour Trees/JimmyFightTrigger.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d69f03b258b57d142aedb2501fb2a531 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Behaviour Trees/NPC FollowTree.asset b/Assets/Data/Behaviour Trees/NPC FollowTree.asset new file mode 100644 index 00000000..1608a89c --- /dev/null +++ b/Assets/Data/Behaviour Trees/NPC FollowTree.asset @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !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: 54fb5e73c80040247a00b01917c6e426, type: 3} + m_Name: NPC FollowTree + m_EditorClassIdentifier: + tree: + serializedNodes: + - childCount: 3 + element: + propertyInfo: [] + nodeTypeName: BehaviourTree.SequenceNode + firstChildIndex: 1 + - childCount: 0 + element: + propertyInfo: + - name: tag-name + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: Player + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: actor-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: target-object + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.FindActorByTagNode + firstChildIndex: 2 + - childCount: 0 + element: + propertyInfo: + - name: actor-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: target-object + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: position-destination + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: target-destination + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.GetActorPositionNode + firstChildIndex: 3 + - childCount: 0 + element: + propertyInfo: + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: target-destination + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: stop-distance + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 2 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: move-speed + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 10 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SimpleMoveNode + firstChildIndex: 4 diff --git a/Assets/Data/Behaviour Trees/NPC FollowTree.asset.meta b/Assets/Data/Behaviour Trees/NPC FollowTree.asset.meta new file mode 100644 index 00000000..c65dfd7e --- /dev/null +++ b/Assets/Data/Behaviour Trees/NPC FollowTree.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5022140c4fe67e1489a5b6e3f5ff71f2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Behaviour Trees/SetupSneekoTree.asset b/Assets/Data/Behaviour Trees/SneekoTest.asset similarity index 72% rename from Assets/Data/Behaviour Trees/SetupSneekoTree.asset rename to Assets/Data/Behaviour Trees/SneekoTest.asset index 3d162b1c..521796c9 100644 --- a/Assets/Data/Behaviour Trees/SetupSneekoTree.asset +++ b/Assets/Data/Behaviour Trees/SneekoTest.asset @@ -10,7 +10,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 54fb5e73c80040247a00b01917c6e426, type: 3} - m_Name: SetupSneekoTree + m_Name: SneekoTest m_EditorClassIdentifier: tree: serializedNodes: @@ -26,6 +26,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -39,6 +40,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -57,6 +59,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -70,6 +73,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -84,10 +88,41 @@ MonoBehaviour: - childCount: 0 element: propertyInfo: + - name: property-type + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+CompareType, Assembly-CSharp, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + forceReserialization: 1 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: operator + property: + propertyType: 6 + objectType: BehaviourTree.CompareNode+OperatorType, Assembly-CSharp, + Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + forceReserialization: 0 + value: + b: 0 + n: 0 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 - name: source-property property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -97,10 +132,11 @@ MonoBehaviour: a: [] e: 0 aType: 0 - - name: comparison-number + - name: comparator property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -110,7 +146,7 @@ MonoBehaviour: a: [] e: 0 aType: 0 - nodeTypeName: BehaviourTree.EqualsNode + nodeTypeName: BehaviourTree.CompareNode firstChildIndex: 4 - childCount: 0 element: @@ -119,6 +155,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -132,6 +169,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 2 diff --git a/Assets/Data/Behaviour Trees/SneekoTest.asset.meta b/Assets/Data/Behaviour Trees/SneekoTest.asset.meta new file mode 100644 index 00000000..4ce542bb --- /dev/null +++ b/Assets/Data/Behaviour Trees/SneekoTest.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e6bff16d48bace4ca5896521841a0f6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Behaviour Trees/Test Tree.asset b/Assets/Data/Behaviour Trees/Test Tree.asset index 30560300..7bf26915 100644 --- a/Assets/Data/Behaviour Trees/Test Tree.asset +++ b/Assets/Data/Behaviour Trees/Test Tree.asset @@ -26,6 +26,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -39,6 +40,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -96,6 +98,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -109,6 +112,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -163,6 +167,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 1.1 @@ -176,6 +181,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -220,6 +226,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -251,6 +258,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -287,6 +295,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 3 @@ -300,6 +309,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -349,6 +359,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -362,6 +373,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 1 @@ -375,6 +387,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 2 @@ -408,6 +421,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -439,6 +453,7 @@ MonoBehaviour: property: propertyType: 4 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -452,6 +467,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 3 @@ -465,6 +481,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -527,6 +544,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 0.2 @@ -540,6 +558,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -584,6 +603,7 @@ MonoBehaviour: property: propertyType: 4 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -597,6 +617,7 @@ MonoBehaviour: property: propertyType: 1 objectType: + forceReserialization: 0 value: b: 0 n: 3 @@ -610,6 +631,7 @@ MonoBehaviour: property: propertyType: 2 objectType: + forceReserialization: 0 value: b: 0 n: 0 @@ -664,6 +686,53 @@ MonoBehaviour: e: 0 aType: 0 nodeTypeName: BehaviourTree.SuccessNode + firstChildIndex: 21 + - childCount: 0 + element: + propertyInfo: + - name: position-source + property: + propertyType: 2 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0 + s: random-position + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: stop-distance + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0.1 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + - name: move-speed + property: + propertyType: 1 + objectType: + forceReserialization: 0 + value: + b: 0 + n: 0.8 + s: + o: {fileID: 0} + v: {x: 0, y: 0} + a: [] + e: 0 + aType: 0 + nodeTypeName: BehaviourTree.SimpleMoveNode firstChildIndex: 22 - childCount: 0 element: diff --git a/Assets/Data/Dialogue Graphs/TestNPC2Dialogue.asset b/Assets/Data/Dialogue Graphs/TestNPC2Dialogue.asset index c14505ed..9d3f9249 100644 --- a/Assets/Data/Dialogue Graphs/TestNPC2Dialogue.asset +++ b/Assets/Data/Dialogue Graphs/TestNPC2Dialogue.asset @@ -24,6 +24,7 @@ MonoBehaviour: dialogueIndexOverrides: - targetUniqueID: indexOverride: 1 + customBehaviour: {fileID: 0} transitions: - name: Transition from: 0 @@ -37,3 +38,4 @@ MonoBehaviour: sexinessMod: 0 questNotes: [] dialogueIndexOverrides: [] + customBehaviour: {fileID: 0} diff --git a/Assets/Data/Dialogue Graphs/TestNPCDialogue.asset b/Assets/Data/Dialogue Graphs/TestNPCDialogue.asset index 341faab6..f7224f6b 100644 --- a/Assets/Data/Dialogue Graphs/TestNPCDialogue.asset +++ b/Assets/Data/Dialogue Graphs/TestNPCDialogue.asset @@ -64,7 +64,7 @@ MonoBehaviour: dialogueIndexOverrides: - targetUniqueID: indexOverride: 1 - customBehaviour: {fileID: 11400000, guid: 64a6070144d65fb4a86a0493bb5d72a7, type: 2} + customBehaviour: {fileID: 11400000, guid: 3e6bff16d48bace4ca5896521841a0f6, type: 2} - name: Errrrr, never mind. See ya later. body: Alright. Later! position: {x: 338, y: -49} diff --git a/Assets/Data/Dialogue Graphs/Tutorial Dialogue/In the Street 2/Tutorial-Jimmy.asset b/Assets/Data/Dialogue Graphs/Tutorial Dialogue/In the Street 2/Tutorial-Jimmy.asset index 9147338f..7f3fbd8e 100644 --- a/Assets/Data/Dialogue Graphs/Tutorial Dialogue/In the Street 2/Tutorial-Jimmy.asset +++ b/Assets/Data/Dialogue Graphs/Tutorial Dialogue/In the Street 2/Tutorial-Jimmy.asset @@ -60,7 +60,7 @@ MonoBehaviour: dialogueIndexOverrides: - targetUniqueID: indexOverride: 1 - customBehaviour: {fileID: 0} + customBehaviour: {fileID: 11400000, guid: d69f03b258b57d142aedb2501fb2a531, type: 2} transitions: - name: Transition from: 0 diff --git a/Assets/Prefabs/TestEnemy.prefab b/Assets/Prefabs/TestEnemy.prefab index 16cf7d2a..a0926ada 100644 --- a/Assets/Prefabs/TestEnemy.prefab +++ b/Assets/Prefabs/TestEnemy.prefab @@ -169,13 +169,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7157c15a42769b0458c85c94a11a8d26, type: 3} m_Name: m_EditorClassIdentifier: - initialMaxHealth: 15 + initialMaxHealth: 10 idleAnimations: {fileID: 11400000, guid: fb206d7e94c25e94b899ed54a07145c6, type: 2} moveAnimations: {fileID: 11400000, guid: e22d4c8424148f645ae60e803585d737, type: 2} hurtAnimations: {fileID: 11400000, guid: 1fce7b2292cd9e545984412811fa1820, type: 2} actions: - {fileID: 11400000, guid: cd54c1a41bfdb6745b6a33c7b765967e, type: 2} - flashDuration: 0.2 --- !u!114 &4011296362009397300 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/UI/Canvas.prefab b/Assets/Prefabs/UI/Canvas.prefab index 81f1ff26..5a1c5a96 100644 --- a/Assets/Prefabs/UI/Canvas.prefab +++ b/Assets/Prefabs/UI/Canvas.prefab @@ -454,7 +454,6 @@ GameObject: - component: {fileID: 1594993686604947230} - component: {fileID: 1594993686604947228} - component: {fileID: 1594993686604947229} - - component: {fileID: 1594993686604947203} - component: {fileID: 216887218} m_Layer: 5 m_Name: DialogueUI @@ -524,18 +523,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!114 &1594993686604947203 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1594993686604947231} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6314624073fd19344a66e0b14acc8eef, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &216887218 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Presets/Animator.preset b/Assets/Presets/Animator.preset new file mode 100644 index 00000000..6a7f5b1c --- /dev/null +++ b/Assets/Presets/Animator.preset @@ -0,0 +1,59 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!181963792 &2655988077585873504 +Preset: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Animator + m_TargetType: + m_NativeTypeID: 95 + m_ManagedTypePPtr: {fileID: 0} + m_ManagedTypeFallback: + m_Properties: + - target: {fileID: 0} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Avatar + value: + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Controller + value: + objectReference: {fileID: 9100000, guid: d3af1bb34e9ffb044886be104dc98f2f, type: 2} + - target: {fileID: 0} + propertyPath: m_CullingMode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_UpdateMode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_ApplyRootMotion + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_LinearVelocityBlending + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_WarningMessage + value: + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_HasTransformHierarchy + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_AllowConstantClipSamplingOptimization + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_KeepAnimatorControllerStateOnDisable + value: 0 + objectReference: {fileID: 0} + m_ExcludedProperties: [] diff --git a/Assets/Presets/Animator.preset.meta b/Assets/Presets/Animator.preset.meta new file mode 100644 index 00000000..687610ae --- /dev/null +++ b/Assets/Presets/Animator.preset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ff96623c6707a72418a0b766fe2b0e8c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2655988077585873504 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 9df96b5b..f42d9643 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -398,7 +398,7 @@ MonoBehaviour: m_GameObject: {fileID: 109492335} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -487,8 +487,196 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 21 + m_RootOrder: 22 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &113309044 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 113309049} + - component: {fileID: 113309048} + - component: {fileID: 113309047} + - component: {fileID: 113309046} + - component: {fileID: 113309052} + - component: {fileID: 113309051} + - component: {fileID: 113309045} + - component: {fileID: 113309050} + m_Layer: 8 + m_Name: TestNPCMover + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &113309045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7157c15a42769b0458c85c94a11a8d26, type: 3} + m_Name: + m_EditorClassIdentifier: + initialMaxHealth: 6 + idleAnimations: {fileID: 11400000, guid: fb206d7e94c25e94b899ed54a07145c6, type: 2} + moveAnimations: {fileID: 11400000, guid: e22d4c8424148f645ae60e803585d737, type: 2} + hurtAnimations: {fileID: 11400000, guid: 1fce7b2292cd9e545984412811fa1820, type: 2} + actions: + - {fileID: 11400000, guid: cd54c1a41bfdb6745b6a33c7b765967e, type: 2} +--- !u!50 &113309046 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 4 +--- !u!58 &113309047 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Radius: 0.5 +--- !u!212 &113309048 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: d58d73c2ff94bc84e88ee2cf8e12bc09, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.5859375, y: 0.64377683} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &113309049 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5.66, y: -1.92, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &113309050 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 255646b43a4b22b4586a6b091e9ce397, type: 3} + m_Name: + m_EditorClassIdentifier: + behaviourTree: {fileID: 11400000, guid: de69ac2176667774d94e83467a58ecce, type: 2} +--- !u!114 &113309051 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3841cfd75fe64b8498769758ea31c7be, type: 3} + m_Name: + m_EditorClassIdentifier: + defaultAnimation: {fileID: 7400000, guid: 511c335ee19612a4e8474882b1c5b7b7, type: 2} +--- !u!95 &113309052 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 113309044} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: d3af1bb34e9ffb044886be104dc98f2f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 --- !u!1 &141597915 GameObject: m_ObjectHideFlags: 0 @@ -520,7 +708,7 @@ MonoBehaviour: m_GameObject: {fileID: 141597915} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -616,7 +804,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 15 + m_RootOrder: 16 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &141597920 MonoBehaviour: @@ -1290,6 +1478,7 @@ GameObject: - component: {fileID: 511373792} - component: {fileID: 511373795} - component: {fileID: 511373794} + - component: {fileID: 511373796} m_Layer: 8 m_Name: TestNPC m_TagString: Untagged @@ -1371,7 +1560,7 @@ MonoBehaviour: m_GameObject: {fileID: 511373791} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -1398,6 +1587,18 @@ CircleCollider2D: m_Offset: {x: 0, y: 0} serializedVersion: 2 m_Radius: 0.32188842 +--- !u!114 &511373796 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511373791} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6314624073fd19344a66e0b14acc8eef, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &539150545 GameObject: m_ObjectHideFlags: 0 @@ -1427,7 +1628,7 @@ MonoBehaviour: m_GameObject: {fileID: 539150545} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -1561,7 +1762,7 @@ MonoBehaviour: m_GameObject: {fileID: 561039016} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -1650,7 +1851,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 19 + m_RootOrder: 20 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &608919353 GameObject: @@ -1680,7 +1881,7 @@ MonoBehaviour: m_GameObject: {fileID: 608919353} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -1768,11 +1969,11 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 608919353} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2.89, y: -4.2, z: 0} + m_LocalPosition: {x: -5.41, y: -0.13, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 23 + m_RootOrder: 24 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &624982963 GameObject: @@ -2620,7 +2821,7 @@ MonoBehaviour: m_GameObject: {fileID: 940472397} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -2708,11 +2909,11 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 940472397} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.93, y: -4.22, z: 0} + m_LocalPosition: {x: -5.65, y: -3.8, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 22 + m_RootOrder: 23 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &940472402 MonoBehaviour: @@ -2927,7 +3128,7 @@ MonoBehaviour: m_GameObject: {fileID: 1047971987} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -3016,7 +3217,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 20 + m_RootOrder: 21 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1056019372 stripped MonoBehaviour: @@ -3058,7 +3259,7 @@ MonoBehaviour: m_GameObject: {fileID: 1060987544} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -3148,7 +3349,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 24 + m_RootOrder: 25 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1085417769 stripped MonoBehaviour: @@ -3991,7 +4192,7 @@ MonoBehaviour: m_GameObject: {fileID: 1398485439} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -4080,7 +4281,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 17 + m_RootOrder: 18 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1410663226 GameObject: @@ -4110,7 +4311,7 @@ MonoBehaviour: m_GameObject: {fileID: 1410663226} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -4199,7 +4400,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 18 + m_RootOrder: 19 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1774711815 stripped MonoBehaviour: @@ -4364,7 +4565,7 @@ Transform: m_Children: - {fileID: 1368910123} m_Father: {fileID: 0} - m_RootOrder: 16 + m_RootOrder: 17 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!95 &1817463533 Animator: diff --git a/Assets/Scenes/TutorialTown.unity b/Assets/Scenes/TutorialTown.unity index 02eca651..06740cdf 100644 --- a/Assets/Scenes/TutorialTown.unity +++ b/Assets/Scenes/TutorialTown.unity @@ -908,7 +908,7 @@ MonoBehaviour: m_GameObject: {fileID: 541681862} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -1317,7 +1317,7 @@ MonoBehaviour: m_GameObject: {fileID: 727577739} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, @@ -1576,8 +1576,8 @@ GameObject: - component: {fileID: 996557717} - component: {fileID: 996557716} - component: {fileID: 996557712} - - component: {fileID: 996557718} - component: {fileID: 996557720} + - component: {fileID: 996557718} m_Layer: 8 m_Name: Jimmy NPC m_TagString: Untagged @@ -1594,15 +1594,14 @@ MonoBehaviour: m_GameObject: {fileID: 996557711} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7fba3685198575341bfedcdddb0b58fd, type: 3} + m_Script: {fileID: 11500000, guid: 82d10099f0b38ec40b917b3fa80f253e, type: 3} m_Name: m_EditorClassIdentifier: tooltipPrefab: {fileID: 7921253115471860706, guid: 1ff60417f84c75a4b929b73aa77269b9, type: 3} interactHint: Talk characterName: Jimmy - portrait: {fileID: 9076241471376651639, guid: 93cb617996c05b6489970fc681f440ef, - type: 3} + portrait: {fileID: 21300000, guid: d58d73c2ff94bc84e88ee2cf8e12bc09, type: 3} dialogueGraphs: - {fileID: 11400000, guid: 5b4e3c749eebe4248b38084f7c56a999, type: 2} - {fileID: 11400000, guid: ae69f4ad827a0414a91c5ae9bf3b5f7f, type: 2} @@ -1684,7 +1683,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 996557711} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.71, y: -0.72, z: 0} + m_LocalPosition: {x: -8, y: -0.3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -1702,7 +1701,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3841cfd75fe64b8498769758ea31c7be, type: 3} m_Name: m_EditorClassIdentifier: - defaultAnimation: {fileID: 7400000, guid: 9e341e0589474734e85c03acab0bef7d, type: 2} + defaultAnimation: {fileID: 7400000, guid: f3d8518500d6a1f4db92b67fe4d88910, type: 2} --- !u!95 &996557717 Animator: serializedVersion: 3 @@ -1731,13 +1730,15 @@ MonoBehaviour: m_GameObject: {fileID: 996557711} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ff501692e9724c7439955e72bfce135c, type: 3} + m_Script: {fileID: 11500000, guid: 7157c15a42769b0458c85c94a11a8d26, type: 3} m_Name: m_EditorClassIdentifier: - initialMaxHealth: 10 + initialMaxHealth: 8 idleAnimations: {fileID: 11400000, guid: 5efbdb18b6bca104e927472b7dd579d8, type: 2} moveAnimations: {fileID: 11400000, guid: 23f348e6b58f0704fb0c3669a6b7c8f6, type: 2} hurtAnimations: {fileID: 11400000, guid: 23f348e6b58f0704fb0c3669a6b7c8f6, type: 2} + actions: + - {fileID: 11400000, guid: cd54c1a41bfdb6745b6a33c7b765967e, type: 2} --- !u!50 &996557719 Rigidbody2D: serializedVersion: 4 @@ -1751,7 +1752,7 @@ Rigidbody2D: m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 m_Mass: 1 - m_LinearDrag: 0 + m_LinearDrag: 10 m_AngularDrag: 0.05 m_GravityScale: 1 m_Material: {fileID: 0} @@ -1771,7 +1772,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 255646b43a4b22b4586a6b091e9ce397, type: 3} m_Name: m_EditorClassIdentifier: - behaviourTree: {fileID: 11400000, guid: 75e6ba3057cc6b04e9727d170650b9fe, type: 2} + behaviourTree: {fileID: 11400000, guid: 8bd8b783c74999f44b82c57c7c59c5f6, type: 2} --- !u!1 &1169265892 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Editor/BehaviourTreeInspector.cs b/Assets/Scripts/Editor/BehaviourTreeInspector.cs index 492719b2..b22bff89 100644 --- a/Assets/Scripts/Editor/BehaviourTreeInspector.cs +++ b/Assets/Scripts/Editor/BehaviourTreeInspector.cs @@ -9,6 +9,7 @@ namespace BehaviourTree public class BehaviourTreeInspector : Editor { private BehaviourTree behaviourTree; + private Behaviour selected = null; private bool isArrayExpanded = false; private int arrayLength = 0; @@ -25,6 +26,13 @@ public override void OnInspectorGUI() Behaviour node = behaviourTree.selectedNode; if (node == null) return; + if (selected == null || selected != node) + { + isArrayExpanded = false; + arrayLength = 0; + arr = null; + } + selected = node; ClearArrayData(); @@ -32,7 +40,8 @@ public override void OnInspectorGUI() GUILayout.Label(name); foreach (string propertyName in node.Properties.Keys) { - DisplayProperty(propertyName, node.Properties[propertyName]); + bool reserializing = DisplayProperty(propertyName, node.Properties[propertyName]); + if (reserializing) break; } serializedObject.ApplyModifiedProperties(); @@ -40,12 +49,12 @@ public override void OnInspectorGUI() Repaint(); } - private void DisplayProperty(string name, VariableProperty property) + private bool DisplayProperty(string name, VariableProperty property) { if (property.PropertyType == VariableProperty.Type.Array) { DisplayArray(name, property); - return; + return false; } GUILayout.BeginHorizontal(); @@ -54,29 +63,72 @@ private void DisplayProperty(string name, VariableProperty property) switch (property.PropertyType) { case VariableProperty.Type.Boolean: - property.Set(GUILayout.Toggle(property.GetBoolean(), GUIContent.none)); + bool bPrev = property.GetBoolean(); + bool bNew = GUILayout.Toggle(bPrev, GUIContent.none); + property.Set(bNew); + if (property.ForceReserialization && bPrev != bNew) + { + selected.Node.Serialize(selected); + return true; + } break; case VariableProperty.Type.Number: - property.Set(EditorGUILayout.DoubleField(property.GetNumber())); + double nPrev = property.GetNumber(); + double nNew = EditorGUILayout.DoubleField(nPrev); + property.Set(nNew); + if (property.ForceReserialization && nPrev != nNew) + { + selected.Node.Serialize(selected); + return true; + } break; case VariableProperty.Type.String: - property.Set(GUILayout.TextField(property.GetString())); + string sPrev = property.GetString(); + string sNew = GUILayout.TextField(sPrev); + property.Set(sNew); + if (property.ForceReserialization && sPrev != sNew) + { + selected.Node.Serialize(selected); + return true; + } break; case VariableProperty.Type.Object: - property.Set(EditorGUILayout.ObjectField(property.GetObject(), property.ObjectType, true)); + Object oPrev = property.GetObject(); + Object oNew = EditorGUILayout.ObjectField(oPrev, property.ObjectType, true); + property.Set(oNew); + if (property.ForceReserialization && oPrev != oNew) + { + selected.Node.Serialize(selected); + return true; + } break; case VariableProperty.Type.Vector: - property.Set(EditorGUILayout.Vector2Field("", property.GetVector())); + Vector2 vPrev = property.GetVector(); + Vector2 vNew = EditorGUILayout.Vector2Field("", vPrev); + property.Set(vNew); + if (property.ForceReserialization && vPrev != vNew) + { + selected.Node.Serialize(selected); + return true; + } break; case VariableProperty.Type.Enum: - System.Enum eVal = (System.Enum)System.Enum.ToObject(property.ObjectType, property.GetEnum()); + int ePrev = property.GetEnum(); + System.Enum eVal = (System.Enum)System.Enum.ToObject(property.ObjectType, ePrev); string sResult = EditorGUILayout.EnumPopup(eVal).ToString(); - int iResult = (int)System.Enum.Parse(property.ObjectType, sResult); - property.Set(iResult); + int eNew = (int)System.Enum.Parse(property.ObjectType, sResult); + property.Set(eNew); + if (property.ForceReserialization && ePrev != eNew) + { + selected.Node.Serialize(selected); + return true; + } break; } GUILayout.EndHorizontal(); + + return false; } private void DisplayArray(string name, VariableProperty property) diff --git a/Assets/Scripts/Game/Core/Actor.cs b/Assets/Scripts/Game/Core/Actor.cs index da4bffec..6d61526c 100644 --- a/Assets/Scripts/Game/Core/Actor.cs +++ b/Assets/Scripts/Game/Core/Actor.cs @@ -38,10 +38,14 @@ public int Health private UnityEvent onDeath = new UnityEvent(); public UnityEvent OnDeath { get => onDeath; } + private UnityEvent onPositionChanged = new UnityEvent(); + public UnityEvent OnPositionChanged { get => onPositionChanged; } + protected ActionData actionData; protected Vector2Int facingDirection; protected new Rigidbody2D rigidbody2D; protected Animator2D animator2D; + private Vector3 prevFramePosition; protected virtual void Awake() { @@ -59,6 +63,9 @@ protected virtual void Awake() protected virtual void Update() { + // Update position info + if (transform.position != prevFramePosition) onPositionChanged.Invoke(transform.position); + // Animate movement if (GetMoveDirection() != Vector2Int.zero) { @@ -68,6 +75,8 @@ protected virtual void Update() { AnimateIdle(); } + + prevFramePosition = transform.position; } public virtual void TakeDamage(int damage) diff --git a/Assets/Scripts/Game/Core/Entity.cs b/Assets/Scripts/Game/Core/Entity.cs index 55b99450..7d1b0715 100644 --- a/Assets/Scripts/Game/Core/Entity.cs +++ b/Assets/Scripts/Game/Core/Entity.cs @@ -12,30 +12,6 @@ public abstract class Entity : MonoBehaviour private Dictionary propertyChangedEvents = new Dictionary(); - ///Returns the Entity matching the given unique id. The desired Entity must have a corresponding UniqueID component. - public static Entity Find(string id) - { - GameObject obj = UniqueID.Get(id); - if (obj == null) - { - Debug.LogWarning($"Entity.Find() failed to find Entity with ID \"{id}\"; returning null."); - return null; - } - return obj.GetComponent(); - } - - ///Returns the Entity matching the given unique id. The desired Entity must have a corresponding UniqueID component. - public static T Find(string id) where T : Entity - { - GameObject obj = UniqueID.Get(id); - if (obj == null) - { - Debug.LogWarning($"Entity.Find() failed to find Entity with ID \"{id}\"; returning null."); - return null; - } - return obj.GetComponent(); - } - public bool HasProperty(PropertyName name) { return properties.HasProperty(name); diff --git a/Assets/Scripts/Game/Core/UniqueID.cs b/Assets/Scripts/Game/Core/UniqueID.cs index 3a72dd4d..884d4810 100644 --- a/Assets/Scripts/Game/Core/UniqueID.cs +++ b/Assets/Scripts/Game/Core/UniqueID.cs @@ -18,10 +18,23 @@ protected void Awake() uniqueObjects.Add(uniqueID, gameObject); } - ///Low-level interface for getting objects by unique ID. You almost always want the Entity.Find() wrapper instead! + ///Low-level interface for getting objects by unique ID. public static GameObject Get(string id) { - return uniqueObjects.ContainsKey(id) ? uniqueObjects[id] : null; + GameObject obj = uniqueObjects.ContainsKey(id) ? uniqueObjects[id] : null; + if (obj == null) + { + Debug.LogWarning($"UniqueID.Get() failed to find Object with ID \"{id}\"; returning null."); + return null; + } + return obj; + } + + ///Low-level generic interface for getting objects by unique ID. + public static T Get(string id) where T : Object + { + GameObject obj = Get(id); + return obj != null ? obj.GetComponent() : null; } private bool ValidateNotEmpty(string uniqueID) diff --git a/Assets/Scripts/Game/Items/Interactable.cs b/Assets/Scripts/Game/Items/Interactable.cs index 8000f3d4..5b2e3516 100644 --- a/Assets/Scripts/Game/Items/Interactable.cs +++ b/Assets/Scripts/Game/Items/Interactable.cs @@ -4,7 +4,7 @@ namespace RPG { - public abstract class Interactable : Entity + public abstract class Interactable : MonoBehaviour { [SerializeField] private Tooltip tooltipPrefab; [SerializeField] [TextArea] private string interactHint; diff --git a/Assets/Scripts/Game/NPC.meta b/Assets/Scripts/Game/NPC.meta new file mode 100644 index 00000000..228fdfa0 --- /dev/null +++ b/Assets/Scripts/Game/NPC.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0c239f08addd9744aad65aa10bc2c82d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Game/Quest/QuestGiver.cs b/Assets/Scripts/Game/NPC/NPC.cs similarity index 62% rename from Assets/Scripts/Game/Quest/QuestGiver.cs rename to Assets/Scripts/Game/NPC/NPC.cs index 61e4d561..7bcab25e 100644 --- a/Assets/Scripts/Game/Quest/QuestGiver.cs +++ b/Assets/Scripts/Game/NPC/NPC.cs @@ -5,7 +5,7 @@ namespace RPG { - public class QuestGiver : Interactable + public class NPC : Interactable { [SerializeField] private string characterName; public string CharacterName { get => characterName; } @@ -22,5 +22,17 @@ public override void Interact(Player player) DialogueGraph graph = dialogueGraphs[ActiveIndex]; GameManager.DialogueSystem.BeginDialogue(this, graph); } + + // TODO: make enemy stuff based on factions! + + public void SetEnemy(bool isEnemy) + { + gameObject.layer = isEnemy ? LayerMask.NameToLayer("Enemy") : LayerMask.NameToLayer("Interactable"); + } + + public bool IsEnemy() + { + return gameObject.layer == LayerMask.NameToLayer("Enemy"); + } } } diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/EqualsNode.cs.meta b/Assets/Scripts/Game/NPC/NPC.cs.meta similarity index 83% rename from Assets/Scripts/Tools/Behaviour Tree/Nodes/EqualsNode.cs.meta rename to Assets/Scripts/Game/NPC/NPC.cs.meta index d1120b86..9e2d1df0 100644 --- a/Assets/Scripts/Tools/Behaviour Tree/Nodes/EqualsNode.cs.meta +++ b/Assets/Scripts/Game/NPC/NPC.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2f3c96ed6d2244642ab00c01103c4876 +guid: 82d10099f0b38ec40b917b3fa80f253e MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Game/Player/Player.cs b/Assets/Scripts/Game/Player/Player.cs index f31e2f78..4607d64a 100644 --- a/Assets/Scripts/Game/Player/Player.cs +++ b/Assets/Scripts/Game/Player/Player.cs @@ -37,7 +37,6 @@ public class Player : Actor private bool isGCDActive; private bool isAnimLocked; - private Vector3 prevFramePosition; private Collider2D[] interactTargets = new Collider2D[MAX_INTERACT_TARGETS]; private int numInteractTargets = 0; private Interactable targetInteractable; @@ -45,8 +44,6 @@ public class Player : Actor private YieldInstruction animLockInstruction; private YieldInstruction globalCooldownInstruction; - private UnityEvent onPositionChanged = new UnityEvent(); - protected override void Awake() { base.Awake(); @@ -67,7 +64,6 @@ protected override void Awake() } Equip(ItemSlot.Mainhand, defaultPrimaryWeapon); Equip(ItemSlot.Offhand, defaultSecondaryWeapon); - actionData = new ActionData(LayerMask.GetMask("Enemy")); } @@ -136,9 +132,7 @@ protected override void Update() Vector2 inputDir = new Vector2(inputH, inputV).normalized; // Update position - prevFramePosition = transform.position; rigidbody2D.velocity = inputDir * moveSpeed; - if (transform.position != prevFramePosition) onPositionChanged.Invoke(transform.position); // Run base Actor update base.Update(); @@ -166,6 +160,11 @@ protected override void Update() } } + protected void OnDisable() + { + ClearInteractions(); + } + public void ApplyClassBaseStats(ClassBaseStats classBaseStats) { ClassBaseStats = classBaseStats; @@ -277,18 +276,8 @@ private IEnumerator AnimationLock() private void UpdateInteractions() { - Interactable interactable; - - // Clear current interactions - for (int i = 0; i < numInteractTargets; i++) - { - Collider2D target = interactTargets[i]; - if (target != null && target.TryGetComponent(out interactable)) - { - interactable.SetTooltipActive(false); - } - } - targetInteractable = null; + // Clear interactions + ClearInteractions(); // Check for nearby interactables numInteractTargets = Physics2D.OverlapCircleNonAlloc(transform.position, interactRadius, interactTargets, interactLayer); @@ -305,11 +294,27 @@ private void UpdateInteractions() } // Set the nearest interactable active + Interactable interactable; if (closestIdx >= 0 && interactTargets[closestIdx].TryGetComponent(out interactable)) { targetInteractable = interactable; interactable.SetTooltipActive(true); } } + + private void ClearInteractions() + { + // Clear current interactions + Interactable interactable; + for (int i = 0; i < numInteractTargets; i++) + { + Collider2D target = interactTargets[i]; + if (target != null && target.TryGetComponent(out interactable)) + { + interactable.SetTooltipActive(false); + } + } + targetInteractable = null; + } } } diff --git a/Assets/Scripts/Game/UI/DialoguePanel.cs b/Assets/Scripts/Game/UI/DialoguePanel.cs index 440fcfad..5c354da3 100644 --- a/Assets/Scripts/Game/UI/DialoguePanel.cs +++ b/Assets/Scripts/Game/UI/DialoguePanel.cs @@ -31,18 +31,18 @@ public void Hide() gameObject.SetActive(false); } - public void SetTarget(QuestGiver target) + public void SetTarget(NPC target) { dialoguePortrait.sprite = target.Portrait; dialogueName.text = target.CharacterName; } - public void PlayDialogue(string dialogue) + public void PlayDialogue(string dialogue, UnityAction onFinished) { - StartCoroutine(AnimateDialogue(dialogue)); + StartCoroutine(AnimateDialogue(dialogue, onFinished)); } - private IEnumerator AnimateDialogue(string dialogue) + private IEnumerator AnimateDialogue(string dialogue, UnityAction onFinished) { foreach (GameObject go in buttonPool) { @@ -56,6 +56,8 @@ private IEnumerator AnimateDialogue(string dialogue) dialogueText.text = dialogue.Substring(0, index++); yield return letterCooldown; } + + onFinished(); } public void CreateOption(string name, UnityAction listener) diff --git a/Assets/Scripts/Game/UI/DialogueSystem.cs b/Assets/Scripts/Game/UI/DialogueSystem.cs index 9b53943f..efcd4af9 100644 --- a/Assets/Scripts/Game/UI/DialogueSystem.cs +++ b/Assets/Scripts/Game/UI/DialogueSystem.cs @@ -12,27 +12,34 @@ namespace Dialogue public class DialogueSystem : MonoBehaviour { private YieldInstruction letterCooldown = new WaitForSeconds(0.05f); - private QuestGiver currentTarget; + private NPC currentTarget; private DialogueGraph currentGraph; - private int currentNode = 0; + private int currentNodeIdx = 0; - public void BeginDialogue(QuestGiver target, DialogueGraph graph) + public void BeginDialogue(NPC target, DialogueGraph graph) { + // Disable actions of interacting entities + GameManager.Player.enabled = false; + if (target.TryGetComponent(out BehaviourObject obj)) + { + obj.enabled = false; + } + currentTarget = target; currentGraph = graph; HUD.DialoguePanel.Show(); HUD.DialoguePanel.SetTarget(target); - StartCoroutine(ShowDialogue(0)); + ShowDialogue(0); } - private DialogueGraphTransition[] GetTransitionsFor(DialogueGraph graph, int node) + private DialogueGraphTransition[] GetTransitionsFor(DialogueGraph graph, int nodeIdx) { LinkedList transitionsList = new LinkedList(); foreach (DialogueGraphTransition t in graph.transitions) { - if (t.from == node) + if (t.from == nodeIdx) { transitionsList.AddLast(t); } @@ -43,12 +50,16 @@ private DialogueGraphTransition[] GetTransitionsFor(DialogueGraph graph, int nod return transitions; } - private IEnumerator ShowDialogue(int node) + private void ShowDialogue(int nodeIdx) + { + currentNodeIdx = nodeIdx; + HUD.DialoguePanel.PlayDialogue(currentGraph.nodes[nodeIdx].body, () => OnDialogueNodeFinished(nodeIdx)); + } + + private void OnDialogueNodeFinished(int nodeIdx) { - currentNode = node; - DialogueGraphNode graphNode = currentGraph.nodes[node]; + DialogueGraphNode graphNode = currentGraph.nodes[nodeIdx]; string dialogue = graphNode.body; - HUD.DialoguePanel.PlayDialogue(dialogue); // Apply quest notes for this dialogue node after it finishes reading foreach (QuestNote note in graphNode.questNotes) @@ -59,10 +70,10 @@ private IEnumerator ShowDialogue(int node) // Apply any dialogue index overrides foreach (DialogueIndexOverride idxOverride in graphNode.dialogueIndexOverrides) { - QuestGiver target = currentTarget; + NPC target = currentTarget; if (idxOverride.targetUniqueID != "") { - target = Entity.Find(idxOverride.targetUniqueID); + target = UniqueID.Get(idxOverride.targetUniqueID); } target.ActiveIndex = idxOverride.indexOverride; } @@ -71,26 +82,38 @@ private IEnumerator ShowDialogue(int node) if (graphNode.customBehaviour != null) { Tree.Node root = graphNode.customBehaviour.Root; - root.Element.Tick(root, HUD.DialoguePanel.GetComponent()); + if (currentTarget.TryGetComponent(out BehaviourObject obj)) + { + root.Element.Tick(root, obj); + } + else + { + Debug.LogError("Failed to run custom dialogue behaviour due to target NPC not having a BehaviourObject component!"); + } } - DialogueGraphTransition[] transitions = GetTransitionsFor(currentGraph, node); + // Display transitions + DialogueGraphTransition[] transitions = GetTransitionsFor(currentGraph, nodeIdx); foreach (DialogueGraphTransition t in transitions) { DialogueGraphNode to = t.to < 0 ? currentGraph.exitNode : currentGraph.nodes[t.to]; HUD.DialoguePanel.CreateOption(to.name, (idx) => OnDialogueOptionClicked(idx)); - yield return letterCooldown; } } private void OnDialogueOptionClicked(int index) { - DialogueGraphTransition[] transitions = GetTransitionsFor(currentGraph, currentNode); + DialogueGraphTransition[] transitions = GetTransitionsFor(currentGraph, currentNodeIdx); DialogueGraphTransition transition = transitions[index]; if (transition.to < 0) { // We've reached the end of the tree HUD.DialoguePanel.Hide(); + GameManager.Player.enabled = true; + if (currentTarget.TryGetComponent(out BehaviourObject obj)) + { + obj.enabled = true; + } } else { @@ -100,7 +123,8 @@ private void OnDialogueOptionClicked(int index) GameManager.AlignmentSystem.UpdateMorals(graphNode.moralsMod); GameManager.AlignmentSystem.UpdateSexiness(graphNode.sexinessMod); - StartCoroutine(ShowDialogue(transition.to)); + // Show the next dialogue node + ShowDialogue(transition.to); } } } diff --git a/Assets/Scripts/Tools/Behaviour Tree/Agent.cs b/Assets/Scripts/Tools/Behaviour Tree/Agent.cs index 1bfe2a86..634b4df3 100644 --- a/Assets/Scripts/Tools/Behaviour Tree/Agent.cs +++ b/Assets/Scripts/Tools/Behaviour Tree/Agent.cs @@ -5,22 +5,20 @@ namespace BehaviourTree { - [RequireComponent(typeof(Rigidbody2D), typeof(Animator))] + [RequireComponent(typeof(Rigidbody2D))] public class Agent : BehaviourObject { [SerializeField] private BehaviourTree behaviourTree; public Rigidbody2D Rigidbody2D { get; private set; } - public Animator Animator { get; private set; } private Tree.Node root; protected override void Awake() { base.Awake(); - root = behaviourTree.Root; Rigidbody2D = GetComponent(); - Animator = GetComponent(); + root = behaviourTree.Root; } protected void Update() diff --git a/Assets/Scripts/Tools/Behaviour Tree/BehaviourTreeNodeCreator.cs b/Assets/Scripts/Tools/Behaviour Tree/BehaviourTreeNodeCreator.cs index 958d3299..30f30531 100644 --- a/Assets/Scripts/Tools/Behaviour Tree/BehaviourTreeNodeCreator.cs +++ b/Assets/Scripts/Tools/Behaviour Tree/BehaviourTreeNodeCreator.cs @@ -9,21 +9,30 @@ public enum BehaviourTreeNodeType ExecuteAllNode, SuccessNode, NotNode, - EqualsNode, + CompareNode, HasPropertyNode, + SetPropertyNode, RangeCheckNode, + GetSelfNode, FindActorByTagNode, FindObjectByIdNode, GetActorPositionNode, GetRandomPositionNode, SimpleMoveNode, + IdleNode, SetActionTargetNode, InvokeActionNode, GetDialogueIndexNode, SetDialogueIndexNode, + ForceDialogueNode, + ArrayIteratorNode, + ArrayIncrementNode, GetMoveDirectionNode, GetVectorAxisNode, - SubTreeNode, + SetEnemyNode, + IsEnemyNode, + GetEntityPropertyNode, + SubTreeNode } public static class BehaviourTreeNodeCreator @@ -42,12 +51,16 @@ public static IBehaviourTreeNode Create(BehaviourTreeNodeType type) return new SuccessNode(); case BehaviourTreeNodeType.NotNode: return new NotNode(); - case BehaviourTreeNodeType.EqualsNode: - return new EqualsNode(); + case BehaviourTreeNodeType.CompareNode: + return new CompareNode(); case BehaviourTreeNodeType.HasPropertyNode: return new HasPropertyNode(); + case BehaviourTreeNodeType.SetPropertyNode: + return new SetPropertyNode(); case BehaviourTreeNodeType.RangeCheckNode: return new RangeCheckNode(); + case BehaviourTreeNodeType.GetSelfNode: + return new GetSelfNode(); case BehaviourTreeNodeType.FindActorByTagNode: return new FindActorByTagNode(); case BehaviourTreeNodeType.FindObjectByIdNode: @@ -58,6 +71,8 @@ public static IBehaviourTreeNode Create(BehaviourTreeNodeType type) return new GetRandomPositionNode(); case BehaviourTreeNodeType.SimpleMoveNode: return new SimpleMoveNode(); + case BehaviourTreeNodeType.IdleNode: + return new IdleNode(); case BehaviourTreeNodeType.SetActionTargetNode: return new SetActionTargetNode(); case BehaviourTreeNodeType.InvokeActionNode: @@ -66,10 +81,22 @@ public static IBehaviourTreeNode Create(BehaviourTreeNodeType type) return new GetDialogueIndexNode(); case BehaviourTreeNodeType.SetDialogueIndexNode: return new SetDialogueIndexNode(); + case BehaviourTreeNodeType.ForceDialogueNode: + return new ForceDialogueNode(); + case BehaviourTreeNodeType.ArrayIteratorNode: + return new ArrayIteratorNode(); + case BehaviourTreeNodeType.ArrayIncrementNode: + return new ArrayIncrementNode(); case BehaviourTreeNodeType.GetMoveDirectionNode: return new GetMoveDirectionNode(); case BehaviourTreeNodeType.GetVectorAxisNode: return new GetVectorAxisNode(); + case BehaviourTreeNodeType.SetEnemyNode: + return new SetEnemyNode(); + case BehaviourTreeNodeType.IsEnemyNode: + return new IsEnemyNode(); + case BehaviourTreeNodeType.GetEntityPropertyNode: + return new GetEntityPropertyNode(); case BehaviourTreeNodeType.SubTreeNode: return new SubTreeNode(); default: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIncrementNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIncrementNode.cs new file mode 100644 index 00000000..b3e77352 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIncrementNode.cs @@ -0,0 +1,41 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace BehaviourTree +{ + public class ArrayIncrementNode : IBehaviourTreeNode + { + // TODO: implement Loop, PingPong, etc. increment wrap types? + private const string PROP_INDEX_SRC = "index-source"; + private const string PROP_ARR_LEN = "array-length"; + + public void Serialize(Behaviour behaviour) + { + behaviour.Properties.Add(PROP_INDEX_SRC, new VariableProperty(VariableProperty.Type.String)); + behaviour.Properties.Add(PROP_ARR_LEN, new VariableProperty(VariableProperty.Type.Number)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + // 1. Get the current index from the source + int index = 0; + string indexSrc = behaviour.GetProperty(PROP_INDEX_SRC).GetString(); + if (obj.HasProperty(indexSrc)) + { + index = (int)obj.GetProperty(indexSrc); + } + + // 2. Increment or loop the index and + int arrLen = (int)behaviour.GetProperty(PROP_ARR_LEN).GetNumber(); + index = (index + 1) % arrLen; + + // 3. Save the new index back to the agent + obj.SetProperty(indexSrc, index); + + return NodeStatus.Success; + } + } +} diff --git a/Assets/Scripts/Game/Quest/QuestGiver.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIncrementNode.cs.meta similarity index 83% rename from Assets/Scripts/Game/Quest/QuestGiver.cs.meta rename to Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIncrementNode.cs.meta index 06f6e841..942c0346 100644 --- a/Assets/Scripts/Game/Quest/QuestGiver.cs.meta +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIncrementNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7fba3685198575341bfedcdddb0b58fd +guid: c2619e5c26b02334bafa2ed7facfe6d3 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIteratorNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIteratorNode.cs new file mode 100644 index 00000000..84093854 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIteratorNode.cs @@ -0,0 +1,87 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace BehaviourTree +{ + public class ArrayIteratorNode : IBehaviourTreeNode + { + private enum ValueType { Int, Double, Bool, String, Vector } + + private const string PROP_TYPE = "property-type"; + private const string PROP_ARRAY = "value-array"; + private const string PROP_INDEX_SRC = "index-source"; + private const string PROP_VALUE_DEST = "value-destination"; + + public void Serialize(Behaviour behaviour) + { + if (!behaviour.Properties.ContainsKey(PROP_TYPE)) + { + behaviour.SetProperty(PROP_TYPE, new VariableProperty(VariableProperty.Type.Enum, typeof(ValueType), true)); + } + ValueType valueType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + behaviour.SetProperty(PROP_ARRAY, new VariableProperty(VariableProperty.Type.Array, ToPropertyType(valueType))); + behaviour.SetProperty(PROP_INDEX_SRC, new VariableProperty(VariableProperty.Type.String)); + behaviour.SetProperty(PROP_VALUE_DEST, new VariableProperty(VariableProperty.Type.String)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + // read the current index from the agent (or set to zero if not exists) + int index = 0; + string indexSrc = behaviour.GetProperty(PROP_INDEX_SRC).GetString(); + if (obj.HasProperty(indexSrc)) + { + index = (int)obj.GetProperty(indexSrc); + } + + // get the value at the current index + object[] arr = behaviour.GetProperty(PROP_ARRAY).GetArray(); + object val = null; + ValueType valueType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + switch (valueType) + { + case ValueType.Int: + val = (int)arr[index]; + break; + case ValueType.Double: + val = (double)arr[index]; + break; + case ValueType.Bool: + val = (bool)arr[index]; + break; + case ValueType.String: + val = (string)arr[index]; + break; + case ValueType.Vector: + val = (Vector2)arr[index]; + break; + } + + // store the resulting value on the agent + string valueDest = behaviour.GetProperty(PROP_VALUE_DEST).GetString(); + obj.SetProperty(valueDest, val); + + return NodeStatus.Success; + } + + private VariableProperty.Type ToPropertyType(ValueType valueType) + { + switch (valueType) + { + case ValueType.Int: + case ValueType.Double: + return VariableProperty.Type.Number; + case ValueType.Bool: + return VariableProperty.Type.Boolean; + case ValueType.String: + return VariableProperty.Type.String; + case ValueType.Vector: + return VariableProperty.Type.Vector; + } + return VariableProperty.Type.Number; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIteratorNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIteratorNode.cs.meta new file mode 100644 index 00000000..2b25149c --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ArrayIteratorNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2b55e72d0d3822546b3d3178a5a43c8a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/CompareNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/CompareNode.cs new file mode 100644 index 00000000..40fa24ee --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/CompareNode.cs @@ -0,0 +1,100 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace BehaviourTree +{ + public class CompareNode : IBehaviourTreeNode + { + private enum CompareType { Int, Double, Bool, String, Vector } + private enum OperatorType { Equals, LessThan, GreaterThan } + + private const string PROP_TYPE = "property-type"; + private const string PROP_OPERATOR = "operator"; + private const string PROP_SOURCE = "source-property"; + private const string PROP_COMPARATOR = "comparator"; + + public void Serialize(Behaviour behaviour) + { + if (!behaviour.Properties.ContainsKey(PROP_TYPE)) + { + behaviour.SetProperty(PROP_TYPE, new VariableProperty(VariableProperty.Type.Enum, typeof(CompareType), true)); + } + CompareType comparatorType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + behaviour.SetProperty(PROP_OPERATOR, new VariableProperty(VariableProperty.Type.Enum, typeof(OperatorType))); + behaviour.SetProperty(PROP_SOURCE, new VariableProperty(VariableProperty.Type.String)); + behaviour.SetProperty(PROP_COMPARATOR, new VariableProperty(ToPropertyType(comparatorType))); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + string source = behaviour.GetProperty(PROP_SOURCE).GetString(); + CompareType compareType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + OperatorType operatorType = behaviour.GetProperty(PROP_OPERATOR).GetEnum(); + + bool success = false; + switch (compareType) + { + case CompareType.Int: + int i1 = (int)obj.GetProperty(source); + int i2 = (int)behaviour.GetProperty(PROP_COMPARATOR).GetNumber(); + success = Compare(i1, i2, operatorType); + break; + case CompareType.Double: + double d1 = (double)obj.GetProperty(source); + double d2 = behaviour.GetProperty(PROP_COMPARATOR).GetNumber(); + success = Compare(d1, d2, operatorType); + break; + case CompareType.Bool: + bool b1 = (bool)obj.GetProperty(source); + bool b2 = behaviour.GetProperty(PROP_COMPARATOR).GetBoolean(); + success = Compare(b1, b2, operatorType); + break; + case CompareType.String: + string s1 = (string)obj.GetProperty(source); + string s2 = behaviour.GetProperty(PROP_COMPARATOR).GetString(); + success = Compare(s1, s2, operatorType); + break; + case CompareType.Vector: + Vector2 v1 = (Vector2)obj.GetProperty(source); + Vector2 v2 = behaviour.GetProperty(PROP_COMPARATOR).GetVector(); + success = Compare(v1.sqrMagnitude, v2.sqrMagnitude, operatorType); + break; + } + return success ? NodeStatus.Success : NodeStatus.Failure; + } + + private VariableProperty.Type ToPropertyType(CompareType compareType) + { + switch (compareType) + { + case CompareType.Int: + case CompareType.Double: + return VariableProperty.Type.Number; + case CompareType.Bool: + return VariableProperty.Type.Boolean; + case CompareType.String: + return VariableProperty.Type.String; + case CompareType.Vector: + return VariableProperty.Type.Vector; + } + return VariableProperty.Type.Number; + } + + private bool Compare(T a, T b, OperatorType operation) where T : System.IComparable + { + switch (operation) + { + case OperatorType.Equals: + return a.CompareTo(b) == 0; + case OperatorType.LessThan: + return a.CompareTo(b) < 0; + case OperatorType.GreaterThan: + return a.CompareTo(b) > 0; + } + return false; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/CompareNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/CompareNode.cs.meta new file mode 100644 index 00000000..e2f1e8c1 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/CompareNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 62d9153d9a1afc042acbeb72d5b4aff7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/EqualsNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/EqualsNode.cs deleted file mode 100644 index f22e35b8..00000000 --- a/Assets/Scripts/Tools/Behaviour Tree/Nodes/EqualsNode.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using RPG; - -namespace BehaviourTree -{ - public class EqualsNode : IBehaviourTreeNode - { - private const string PROP_SOURCE = "source-property"; - private const string PROP_NUMBER = "comparison-number"; - - public void Serialize(Behaviour behaviour) - { - behaviour.Properties.Add(PROP_SOURCE, new VariableProperty(VariableProperty.Type.String)); - behaviour.Properties.Add(PROP_NUMBER, new VariableProperty(VariableProperty.Type.Number)); - } - - public NodeStatus Tick(Tree.Node self, BehaviourObject obj) - { - Behaviour behaviour = self.Element; - - string source = behaviour.GetProperty(PROP_SOURCE).GetString(); - int num1 = (int)obj.GetProperty(source); - int num2 = (int)behaviour.GetProperty(PROP_NUMBER).GetNumber(); - if (num1 == num2) return NodeStatus.Success; - - return NodeStatus.Failure; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/ForceDialogueNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ForceDialogueNode.cs new file mode 100644 index 00000000..604c4b8a --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ForceDialogueNode.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using RPG; + +namespace BehaviourTree +{ + public class ForceDialogueNode : IBehaviourTreeNode + { + public void Serialize(Behaviour behaviour) { } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + if (obj.TryGetComponent(out NPC npc)) + { + npc.Interact(GameManager.Player); + } + else + { + throw new MissingComponentException("Current agent does not have the required NPC component!"); + } + return NodeStatus.Success; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/ForceDialogueNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ForceDialogueNode.cs.meta new file mode 100644 index 00000000..13092c68 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/ForceDialogueNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7fded0b12a0f9ac4a99672c36a0813d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetEntityPropertyNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetEntityPropertyNode.cs new file mode 100644 index 00000000..dfa84b0d --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetEntityPropertyNode.cs @@ -0,0 +1,63 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using RPG; + +namespace BehaviourTree +{ + public class GetEntityPropertyNode : IBehaviourTreeNode + { + private const string PROP_NAME = "property-name"; + private const string PROP_TYPE = "property-type"; + private const string PROP_DEST = "property-destination"; + + public void Serialize(Behaviour behaviour) + { + behaviour.Properties.Add(PROP_NAME, new VariableProperty(VariableProperty.Type.Enum, typeof(RPG.PropertyName))); + behaviour.Properties.Add(PROP_TYPE, new VariableProperty(VariableProperty.Type.Enum, typeof(PropertyType))); + behaviour.Properties.Add(PROP_DEST, new VariableProperty(VariableProperty.Type.String)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + Entity entity = null; + if (!obj.TryGetComponent(out entity)) + { + return NodeStatus.Failure; + } + + RPG.PropertyName propName = behaviour.GetProperty(PROP_NAME).GetEnum(); + if (!entity.HasProperty(propName)) + { + Debug.LogWarning("Warning: target entity " + entity.name + " does not have property " + propName); + return NodeStatus.Failure; + } + + PropertyType readType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + string propDest = behaviour.GetProperty(PROP_DEST).GetString(); + switch (readType) + { + case PropertyType.Int: + int iVal = entity.GetProperty(propName); + obj.SetProperty(propDest, iVal); + break; + case PropertyType.Float: + float fVal = entity.GetProperty(propName); + obj.SetProperty(propDest, fVal); + break; + case PropertyType.Bool: + bool bVal = entity.GetProperty(propName); + obj.SetProperty(propDest, bVal); + break; + case PropertyType.String: + string sVal = entity.GetProperty(propName); + obj.SetProperty(propDest, sVal); + break; + } + + return NodeStatus.Success; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetEntityPropertyNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetEntityPropertyNode.cs.meta new file mode 100644 index 00000000..c074145f --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetEntityPropertyNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 193d41c42c68dfe40ad39bb6318ab988 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetSelfNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetSelfNode.cs new file mode 100644 index 00000000..6610d777 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetSelfNode.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using RPG; + +namespace BehaviourTree +{ + public class GetSelfNode : IBehaviourTreeNode + { + private const string PROP_OBJECT_DEST = "object-destination"; + + public void Serialize(Behaviour behaviour) + { + behaviour.Properties.Add(PROP_OBJECT_DEST, new VariableProperty(VariableProperty.Type.String)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + string dest = behaviour.GetProperty(PROP_OBJECT_DEST).GetString(); + obj.SetProperty(dest, obj.gameObject); + return NodeStatus.Success; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetSelfNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetSelfNode.cs.meta new file mode 100644 index 00000000..7c750a98 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/GetSelfNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 22ab99dc6cd71b64e9d6556fe2abe378 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/IdleNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IdleNode.cs new file mode 100644 index 00000000..26c909a1 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IdleNode.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace BehaviourTree +{ + public class IdleNode : IBehaviourTreeNode + { + private const string PROP_IDLE_DURATION = "idle-duration"; + + public void Serialize(Behaviour behaviour) + { + behaviour.Properties.Add(PROP_IDLE_DURATION, new VariableProperty(VariableProperty.Type.Number)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + // Get idle time + double idleTime = 0; + if (obj.HasProperty("idle-time")) + { + idleTime = (double)obj.GetProperty("idle-time"); + } + + // Check if we've been idling for long enough + double idleDuration = behaviour.GetProperty(PROP_IDLE_DURATION).GetNumber(); + if (idleTime < idleDuration) + { + obj.SetProperty("idle-time", idleTime + Time.deltaTime); + return NodeStatus.Running; + } + + // Clear idle timer + obj.RemoveProperty("idle-time"); + return NodeStatus.Success; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/IdleNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IdleNode.cs.meta new file mode 100644 index 00000000..ef9c2e6b --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IdleNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 620d0b4ae03ab46498c63d5266516ab3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/IsEnemyNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IsEnemyNode.cs new file mode 100644 index 00000000..25266e36 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IsEnemyNode.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using RPG; + +namespace BehaviourTree +{ + // TODO: turn this into HasFactionNode later! + public class IsEnemyNode : IBehaviourTreeNode + { + private const string PROP_NPC_SRC = "source-npc"; + + public void Serialize(Behaviour behaviour) + { + behaviour.Properties.Add(PROP_NPC_SRC, new VariableProperty(VariableProperty.Type.String)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + string npcSrc = behaviour.GetProperty(PROP_NPC_SRC).GetString(); + GameObject npc = obj.GetProperty(npcSrc) as GameObject; + return npc.GetComponent().IsEnemy() ? NodeStatus.Success : NodeStatus.Failure; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/IsEnemyNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IsEnemyNode.cs.meta new file mode 100644 index 00000000..ed02a736 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/IsEnemyNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6ab174a2f4541649942f990e0ad1ad2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetEnemyNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetEnemyNode.cs new file mode 100644 index 00000000..3d26d993 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetEnemyNode.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using RPG; + +namespace BehaviourTree +{ + // TODO: turn this into SetFactionNode later! + public class SetEnemyNode : IBehaviourTreeNode + { + private const string PROP_NPC_SRC = "source-npc"; + private const string PROP_IS_ENEMY = "is-enemy"; + + public void Serialize(Behaviour behaviour) + { + behaviour.Properties.Add(PROP_NPC_SRC, new VariableProperty(VariableProperty.Type.String)); + behaviour.Properties.Add(PROP_IS_ENEMY, new VariableProperty(VariableProperty.Type.Boolean)); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + // Get NPC + string npcSrc = behaviour.GetProperty(PROP_NPC_SRC).GetString(); + GameObject npc = obj.GetProperty(npcSrc) as GameObject; + + // Set enemy status + bool isEnemy = behaviour.GetProperty(PROP_IS_ENEMY).GetBoolean(); + npc.GetComponent().SetEnemy(isEnemy); + + return NodeStatus.Success; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetEnemyNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetEnemyNode.cs.meta new file mode 100644 index 00000000..7255a3d2 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetEnemyNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07541633d309568428db2bd9093e7a87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetPropertyNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetPropertyNode.cs new file mode 100644 index 00000000..d4abb618 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetPropertyNode.cs @@ -0,0 +1,76 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace BehaviourTree +{ + public class SetPropertyNode : IBehaviourTreeNode + { + private enum ValueType { Int, Double, Bool, String, Vector } + + private const string PROP_TYPE = "property-type"; + private const string PROP_TARGET = "target-property"; + private const string PROP_VALUE = "property-value"; + + public void Serialize(Behaviour behaviour) + { + if (!behaviour.Properties.ContainsKey(PROP_TYPE)) + { + behaviour.SetProperty(PROP_TYPE, new VariableProperty(VariableProperty.Type.Enum, typeof(ValueType), true)); + } + ValueType valueType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + behaviour.SetProperty(PROP_TARGET, new VariableProperty(VariableProperty.Type.String)); + behaviour.SetProperty(PROP_VALUE, new VariableProperty(ToPropertyType(valueType))); + } + + public NodeStatus Tick(Tree.Node self, BehaviourObject obj) + { + Behaviour behaviour = self.Element; + + string target = behaviour.GetProperty(PROP_TARGET).GetString(); + ValueType valueType = behaviour.GetProperty(PROP_TYPE).GetEnum(); + switch (valueType) + { + case ValueType.Int: + int iVal = (int)behaviour.GetProperty(PROP_VALUE).GetNumber(); + obj.SetProperty(target, iVal); + break; + case ValueType.Double: + double dVal = behaviour.GetProperty(PROP_VALUE).GetNumber(); + obj.SetProperty(target, dVal); + break; + case ValueType.Bool: + bool bVal = behaviour.GetProperty(PROP_VALUE).GetBoolean(); + obj.SetProperty(target, bVal); + break; + case ValueType.String: + string sVal = behaviour.GetProperty(PROP_VALUE).GetString(); + obj.SetProperty(target, sVal); + break; + case ValueType.Vector: + Vector2 vVal = behaviour.GetProperty(PROP_VALUE).GetVector(); + obj.SetProperty(target, vVal); + break; + } + + return NodeStatus.Success; + } + + private VariableProperty.Type ToPropertyType(ValueType valueType) + { + switch (valueType) + { + case ValueType.Int: + case ValueType.Double: + return VariableProperty.Type.Number; + case ValueType.Bool: + return VariableProperty.Type.Boolean; + case ValueType.String: + return VariableProperty.Type.String; + case ValueType.Vector: + return VariableProperty.Type.Vector; + } + return VariableProperty.Type.Number; + } + } +} diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetPropertyNode.cs.meta b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetPropertyNode.cs.meta new file mode 100644 index 00000000..2b9c7b35 --- /dev/null +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SetPropertyNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e86ff3a5538cf64f8d4242a9eb5c794 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/Behaviour Tree/Nodes/SimpleMoveNode.cs b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SimpleMoveNode.cs index 40971b40..2aae439d 100644 --- a/Assets/Scripts/Tools/Behaviour Tree/Nodes/SimpleMoveNode.cs +++ b/Assets/Scripts/Tools/Behaviour Tree/Nodes/SimpleMoveNode.cs @@ -43,4 +43,4 @@ public NodeStatus Tick(Tree.Node self, BehaviourObject obj) return NodeStatus.Failure; } } -} \ No newline at end of file +} diff --git a/Assets/Scripts/Tools/Dialogue Graph/Behaviours/GetDialogueIndexNode.cs b/Assets/Scripts/Tools/Dialogue Graph/Behaviours/GetDialogueIndexNode.cs index 2fd3b131..4d60a27c 100644 --- a/Assets/Scripts/Tools/Dialogue Graph/Behaviours/GetDialogueIndexNode.cs +++ b/Assets/Scripts/Tools/Dialogue Graph/Behaviours/GetDialogueIndexNode.cs @@ -26,7 +26,7 @@ public NodeStatus Tick(Tree.Node self, BehaviourObject obj) // Get and save the dialogue index in destination prop string indexDest = behaviour.GetProperty(PROP_DEST).GetString(); - obj.SetProperty(indexDest, npc.GetComponent().ActiveIndex); + obj.SetProperty(indexDest, npc.GetComponent().ActiveIndex); return NodeStatus.Success; } diff --git a/Assets/Scripts/Tools/Dialogue Graph/Behaviours/SetDialogueIndexNode.cs b/Assets/Scripts/Tools/Dialogue Graph/Behaviours/SetDialogueIndexNode.cs index 60e459fa..1b522f41 100644 --- a/Assets/Scripts/Tools/Dialogue Graph/Behaviours/SetDialogueIndexNode.cs +++ b/Assets/Scripts/Tools/Dialogue Graph/Behaviours/SetDialogueIndexNode.cs @@ -26,7 +26,7 @@ public NodeStatus Tick(Tree.Node self, BehaviourObject obj) // Set the dialogue index int index = (int)behaviour.GetProperty(PROP_INDEX).GetNumber(); - npc.GetComponent().ActiveIndex = index; + npc.GetComponent().ActiveIndex = index; return NodeStatus.Success; } diff --git a/Assets/Scripts/Utils/VariableProperty.cs b/Assets/Scripts/Utils/VariableProperty.cs index e0d97715..bc6eb02f 100644 --- a/Assets/Scripts/Utils/VariableProperty.cs +++ b/Assets/Scripts/Utils/VariableProperty.cs @@ -21,27 +21,36 @@ public System.Type ObjectType private set => objectType = value.AssemblyQualifiedName; } + [SerializeField] private bool forceReserialization; + public bool ForceReserialization + { + get => forceReserialization; + private set => forceReserialization = value; + } + [SerializeField] private Value value; [SerializeField] private Type aType; - public VariableProperty(Type type) + public VariableProperty(Type type, bool forceReserialization = false) { if (type == Type.Object) Debug.LogError("ERROR: Attempting to use Object-based VariableProperty constructor with no Object type! You must specify the Object type!"); if (type == Type.Array) Debug.LogError("ERROR: Attempting to use Array-based VariableProperty constructor with no Array type! You must specify the Array type!"); PropertyType = type; value = new Value(); + ForceReserialization = forceReserialization; } - public VariableProperty(Type type, System.Type objectType) + public VariableProperty(Type type, System.Type objectType, bool forceReserialization = false) { if (type != Type.Object && type != Type.Enum) Debug.LogError("ERROR: Attempting to use Object/Enum-based VariableProperty constructor with non-Object/Enum type!"); PropertyType = type; ObjectType = objectType; value = new Value(); if (type == Type.Enum) Set(0); + ForceReserialization = forceReserialization; } - public VariableProperty(Type type, Type arrayType) + public VariableProperty(Type type, Type arrayType, bool forceReserialization = false) { if (type != Type.Array) Debug.LogError("ERROR: Attempting to use Array-based VariableProperty constructor with non-Array type!"); if (arrayType == Type.Object) Debug.LogError("ERROR: Attempting to use Array-of-Objects-based VariableProperty constructor with no Object type! You must specify the Object type!"); @@ -49,9 +58,10 @@ public VariableProperty(Type type, Type arrayType) PropertyType = Type.Array; aType = arrayType; value = new Value(); + ForceReserialization = forceReserialization; } - public VariableProperty(Type type, Type arrayType, System.Type objectType) + public VariableProperty(Type type, Type arrayType, System.Type objectType, bool forceReserialization = false) { if (type != Type.Array) Debug.LogError("ERROR: Attempting to use Array-based VariableProperty constructor with non-Array type!"); if (arrayType == Type.Array) Debug.LogError("ERROR: VariableProperty Array type cannot have nested Arrays!"); @@ -59,6 +69,7 @@ public VariableProperty(Type type, Type arrayType, System.Type objectType) aType = arrayType; ObjectType = objectType; value = new Value(); + ForceReserialization = forceReserialization; } public bool GetBoolean() diff --git a/ProjectSettings/PresetManager.asset b/ProjectSettings/PresetManager.asset index aff43146..a95946a5 100644 --- a/ProjectSettings/PresetManager.asset +++ b/ProjectSettings/PresetManager.asset @@ -14,3 +14,12 @@ PresetManager: type: 2} m_Filter: m_Disabled: 0 + - first: + m_NativeTypeID: 95 + m_ManagedTypePPtr: {fileID: 0} + m_ManagedTypeFallback: + second: + - m_Preset: {fileID: 2655988077585873504, guid: ff96623c6707a72418a0b766fe2b0e8c, + type: 2} + m_Filter: + m_Disabled: 0