diff --git a/Project Undercover/Assets/Models/YBot/YBoyAnimator.controller b/Project Undercover/Assets/Models/YBot/YBoyAnimator.controller index 3a6b0f8..8defd25 100644 --- a/Project Undercover/Assets/Models/YBot/YBoyAnimator.controller +++ b/Project Undercover/Assets/Models/YBot/YBoyAnimator.controller @@ -32,6 +32,30 @@ AnimatorController: m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 0} + - m_Name: Acknowledging + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: Handshake + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: Interacting + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: Bow + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -107,6 +131,48 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &1101135810287238254 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102150790202348572} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101135981261825622 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102150790202348572} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &1101154328280627494 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -131,9 +197,33 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &1101181216926135622 +--- !u!1101 &1101160161055095008 AnimatorStateTransition: - m_ObjectHideFlags: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Bow + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102165061342770366} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.97 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101170121935933728 +AnimatorStateTransition: + m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_Name: @@ -149,7 +239,31 @@ AnimatorStateTransition: serializedVersion: 3 m_TransitionDuration: 0.25 m_TransitionOffset: 0 - m_ExitTime: 0.70000005 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101181216926135622 +AnimatorStateTransition: + m_ObjectHideFlags: 3 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Interacting + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102150790202348572} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.99980146 m_HasExitTime: 0 m_HasFixedDuration: 1 m_InterruptionSource: 0 @@ -210,6 +324,9 @@ AnimatorStateTransition: - m_ConditionMode: 3 m_ConditionEvent: MoveSpeed m_EventTreshold: 0.1 + - m_ConditionMode: 2 + m_ConditionEvent: Interacting + m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: 1102075779692729400} m_Solo: 0 @@ -224,6 +341,30 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &1101256581112365290 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Interrupted + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102150790202348572} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &1101324464263039550 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -248,6 +389,30 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &1101338341885882894 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Acknowledging + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102931569936446222} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.97 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &1101398582299456848 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -293,6 +458,75 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &1101409095834488426 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102150790202348572} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101520524675126252 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Interrupted + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102150790202348572} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101541003412757350 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Handshake + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102238894748598768} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.97 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &1101775513785162602 AnimatorStateTransition: m_ObjectHideFlags: 3 @@ -317,6 +551,27 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &1101792283228765850 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102238894748598768} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.97 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &1101864097741464978 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -380,6 +635,9 @@ AnimatorState: - {fileID: 1101154328280627494} - {fileID: 1101234958992700582} - {fileID: 1101864097741464978} + - {fileID: 1101338341885882894} + - {fileID: 1101541003412757350} + - {fileID: 1101160161055095008} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -393,6 +651,56 @@ AnimatorState: m_SpeedParameter: m_MirrorParameter: m_CycleOffsetParameter: +--- !u!1102 &1102165061342770366 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Bow + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101135981261825622} + - {fileID: 1101520524675126252} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 6163c5b3aa64c9b43b5c93025af82a2d, type: 3} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1102 &1102238894748598768 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Handshake + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101170121935933728} + - {fileID: 1101409095834488426} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 5e3641c477eb0f94f997258674c78d7a, type: 3} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: --- !u!1102 &1102575800090953688 AnimatorState: serializedVersion: 5 @@ -443,6 +751,31 @@ AnimatorState: m_SpeedParameter: m_MirrorParameter: m_CycleOffsetParameter: +--- !u!1102 &1102931569936446222 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Acknowledging + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101256581112365290} + - {fileID: 1101135810287238254} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 7bbded55674598e4eba78dfa92ea2881, type: 3} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: --- !u!1107 &1107952132972436046 AnimatorStateMachine: serializedVersion: 5 @@ -462,7 +795,16 @@ AnimatorStateMachine: m_Position: {x: 348, y: 120, z: 0} - serializedVersion: 1 m_State: {fileID: 1102575800090953688} - m_Position: {x: 588, y: 12, z: 0} + m_Position: {x: 348, y: -132, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102931569936446222} + m_Position: {x: 348, y: -60, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102238894748598768} + m_Position: {x: 348, y: -204, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102165061342770366} + m_Position: {x: 348, y: -276, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] diff --git a/Project Undercover/Assets/Resources/NPC.prefab b/Project Undercover/Assets/Resources/NPC.prefab index 6cdf4c9..2c2667a 100644 --- a/Project Undercover/Assets/Resources/NPC.prefab +++ b/Project Undercover/Assets/Resources/NPC.prefab @@ -2153,9 +2153,10 @@ MonoBehaviour: _isInteracting: 0 interactions: - {fileID: 11400000, guid: 01a3cf8545fc70f4c90095f144ac9b01, type: 2} + - {fileID: 11400000, guid: 7fc2c5ab600b7b64c832a95abea9589f, type: 2} + - {fileID: 11400000, guid: 80ca1bec2c07531428cf5a84624e44a4, type: 2} spyInteractions: - {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2} - GlowColor: {r: 0, g: 1, b: 0, a: 0} currentState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} remainState: {fileID: 0} navMeshAgent: {fileID: 0} diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcInteract.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcInteract.asset new file mode 100644 index 0000000..c960b6c --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcInteract.asset @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: acbb53bdc7aa18d45a61fd8bac4ed071, type: 3} + m_Name: NpcInteract + m_EditorClassIdentifier: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcInteract.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcInteract.asset.meta new file mode 100644 index 0000000..f7abf06 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcInteract.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 53ec3cb6384716d429b45c03bbf8ff18 +timeCreated: 1507585684 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcWaitForInteractionAcceptanceAction.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcWaitForInteractionAcceptanceAction.asset new file mode 100644 index 0000000..592f017 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcWaitForInteractionAcceptanceAction.asset @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73193a69302e61643a42134080a61e99, type: 3} + m_Name: NpcWaitForInteractionAcceptanceAction + m_EditorClassIdentifier: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcWaitForInteractionAcceptanceAction.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcWaitForInteractionAcceptanceAction.asset.meta new file mode 100644 index 0000000..c89540c --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Actions/NPC/NpcWaitForInteractionAcceptanceAction.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8b6c25cdef34b7b408b0d79d1ce4d7c3 +timeCreated: 1507587807 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/NPC/SelectedObject.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/NPC/SelectedObject.asset new file mode 100644 index 0000000..44ed5ee --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/NPC/SelectedObject.asset @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 857349843f32b194e9bf5d2fe22ca2fc, type: 3} + m_Name: SelectedObject + m_EditorClassIdentifier: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/NPC/SelectedObject.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/NPC/SelectedObject.asset.meta new file mode 100644 index 0000000..9ad1318 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/NPC/SelectedObject.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c14d2053399388247b9cfde51ce5f57c +timeCreated: 1507585044 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/ReceivingInteraction.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/ReceivingInteraction.asset new file mode 100644 index 0000000..1800e0d --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/ReceivingInteraction.asset @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5998aa6b572affe4a98a2e05c3ad4f0b, type: 3} + m_Name: ReceivingInteraction + m_EditorClassIdentifier: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/ReceivingInteraction.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/ReceivingInteraction.asset.meta new file mode 100644 index 0000000..187914e --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/ReceivingInteraction.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 010846579b426744d84ebd4f5f2ce837 +timeCreated: 1507590202 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/Player/PassingMessageToIdleTransition.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/WaitForTransition.asset similarity index 80% rename from Project Undercover/Assets/Resources/ScriptableObjects/Decisions/Player/PassingMessageToIdleTransition.asset rename to Project Undercover/Assets/Resources/ScriptableObjects/Decisions/WaitForTransition.asset index 548bc04..2d8d52f 100644 --- a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/Player/PassingMessageToIdleTransition.asset +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/WaitForTransition.asset @@ -9,7 +9,5 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a3d87936679da304bb792186a3b641cd, type: 3} - m_Name: PassingMessageToIdleTransition + m_Name: WaitForTransition m_EditorClassIdentifier: - fromState: PassingMessage - toState: Idle diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/Player/PassingMessageToIdleTransition.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Decisions/WaitForTransition.asset.meta similarity index 100% rename from Project Undercover/Assets/Resources/ScriptableObjects/Decisions/Player/PassingMessageToIdleTransition.asset.meta rename to Project Undercover/Assets/Resources/ScriptableObjects/Decisions/WaitForTransition.asset.meta diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Bow.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Bow.asset new file mode 100644 index 0000000..b3908dc --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Bow.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3} + m_Name: Bow + m_EditorClassIdentifier: + interactionDescription: bow + receiverDescription: receive bow + initiatorAnimationTrigger: 8 + objectAnimationTrigger: 8 + result: 0 + initialRotation: 0 + objectInitialRotation: 0 + interactionDistance: 1.2 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Bow.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Bow.asset.meta new file mode 100644 index 0000000..b704c82 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Bow.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 80ca1bec2c07531428cf5a84624e44a4 +timeCreated: 1507577166 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Handshake.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Handshake.asset new file mode 100644 index 0000000..83537b2 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Handshake.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3} + m_Name: Handshake + m_EditorClassIdentifier: + interactionDescription: handshake + receiverDescription: receive handshake + initiatorAnimationTrigger: 6 + objectAnimationTrigger: 6 + result: 0 + initialRotation: 0 + objectInitialRotation: 0 + interactionDistance: 1.2 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Handshake.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Handshake.asset.meta new file mode 100644 index 0000000..61301b4 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Handshake.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7fc2c5ab600b7b64c832a95abea9589f +timeCreated: 1507575502 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/TellSecret.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/TellSecret.asset index 6714bf3..b511aba 100644 --- a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/TellSecret.asset +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/TellSecret.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_EditorClassIdentifier: interactionDescription: tell a secret receiverDescription: listen to a secret - characterInteraction: 2 + initiatorAnimationTrigger: 2 + objectAnimationTrigger: 2 result: 1 initialRotation: -60 objectInitialRotation: -60 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset index b46e011..a202753 100644 --- a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset +++ b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_EditorClassIdentifier: interactionDescription: wave receiverDescription: wave back - characterInteraction: 4 + initiatorAnimationTrigger: 4 + objectAnimationTrigger: 4 result: 0 initialRotation: 0 objectInitialRotation: 0 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcInteract.asset b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcInteract.asset new file mode 100644 index 0000000..13a804b --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcInteract.asset @@ -0,0 +1,22 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a6a367e35acd7e44a0a598eaa1d6700, type: 3} + m_Name: NpcInteract + m_EditorClassIdentifier: + actions: + - {fileID: 11400000, guid: 53ec3cb6384716d429b45c03bbf8ff18, type: 2} + transitions: + - decision: {fileID: 11400000, guid: a61bb8f83adfb6c44b3bb56e5163ec72, type: 2} + trueState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} + transitionValue: 1 + - decision: {fileID: 11400000, guid: 54c4574724be54540892c8db5aff93d1, type: 2} + trueState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} + transitionValue: 1 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcInteract.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcInteract.asset.meta new file mode 100644 index 0000000..ec41f1c --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcInteract.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 38fc01dae49e0514d8a6c2853b0ec37b +timeCreated: 1507584986 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/Roam.asset b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcRoam.asset similarity index 65% rename from Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/Roam.asset rename to Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcRoam.asset index 3d167ca..766324a 100644 --- a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/Roam.asset +++ b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcRoam.asset @@ -9,11 +9,14 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5a6a367e35acd7e44a0a598eaa1d6700, type: 3} - m_Name: Roam + m_Name: NpcRoam m_EditorClassIdentifier: actions: - {fileID: 11400000, guid: 2234a34b55804f1408179400cd3068e1, type: 2} transitions: - - decision: {fileID: 11400000, guid: aca961c852aa698469b7c4d36142c175, type: 2} + - decision: {fileID: 11400000, guid: 010846579b426744d84ebd4f5f2ce837, type: 2} trueState: {fileID: 11400000, guid: 963f4d74f828ef94d85740708e8ce1d0, type: 2} transitionValue: 1 + - decision: {fileID: 11400000, guid: c14d2053399388247b9cfde51ce5f57c, type: 2} + trueState: {fileID: 11400000, guid: a70ae0bc5f16c9648ab8c7b1963547ac, type: 2} + transitionValue: 1 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/Roam.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcRoam.asset.meta similarity index 100% rename from Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/Roam.asset.meta rename to Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcRoam.asset.meta diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionAcceptance.asset b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionAcceptance.asset new file mode 100644 index 0000000..d245ddc --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionAcceptance.asset @@ -0,0 +1,28 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a6a367e35acd7e44a0a598eaa1d6700, type: 3} + m_Name: NpcWaitForInteractionAcceptance + m_EditorClassIdentifier: + actions: + - {fileID: 11400000, guid: 8b6c25cdef34b7b408b0d79d1ce4d7c3, type: 2} + transitions: + - decision: {fileID: 11400000, guid: a3e30efde30a6294ba3fee0fa08b7417, type: 2} + trueState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} + transitionValue: 1 + - decision: {fileID: 11400000, guid: d1e5ed22b1756104794e4cdad03e7bd0, type: 2} + trueState: {fileID: 11400000, guid: 38fc01dae49e0514d8a6c2853b0ec37b, type: 2} + transitionValue: 1 + - decision: {fileID: 11400000, guid: 54c4574724be54540892c8db5aff93d1, type: 2} + trueState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} + transitionValue: 1 + - decision: {fileID: 11400000, guid: 010846579b426744d84ebd4f5f2ce837, type: 2} + trueState: {fileID: 11400000, guid: 963f4d74f828ef94d85740708e8ce1d0, type: 2} + transitionValue: 1 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionAcceptance.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionAcceptance.asset.meta new file mode 100644 index 0000000..65befb9 --- /dev/null +++ b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionAcceptance.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a70ae0bc5f16c9648ab8c7b1963547ac +timeCreated: 1507585011 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/WaitForInteractionToEnd.asset b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionToEnd.asset similarity index 94% rename from Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/WaitForInteractionToEnd.asset rename to Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionToEnd.asset index b2a997e..4f2c105 100644 --- a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/WaitForInteractionToEnd.asset +++ b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionToEnd.asset @@ -9,7 +9,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5a6a367e35acd7e44a0a598eaa1d6700, type: 3} - m_Name: WaitForInteractionToEnd + m_Name: NpcWaitForInteractionToEnd m_EditorClassIdentifier: actions: - {fileID: 11400000, guid: a239cb93f4d18fa4baf7a01d44718dbb, type: 2} diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/WaitForInteractionToEnd.asset.meta b/Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionToEnd.asset.meta similarity index 100% rename from Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/WaitForInteractionToEnd.asset.meta rename to Project Undercover/Assets/Resources/ScriptableObjects/States/NPC/NpcWaitForInteractionToEnd.asset.meta diff --git a/Project Undercover/Assets/Resources/Spy.prefab b/Project Undercover/Assets/Resources/Spy.prefab index 225d4bf..f8f4adc 100644 --- a/Project Undercover/Assets/Resources/Spy.prefab +++ b/Project Undercover/Assets/Resources/Spy.prefab @@ -2153,9 +2153,10 @@ MonoBehaviour: _isInteracting: 0 interactions: - {fileID: 11400000, guid: 01a3cf8545fc70f4c90095f144ac9b01, type: 2} + - {fileID: 11400000, guid: 7fc2c5ab600b7b64c832a95abea9589f, type: 2} + - {fileID: 11400000, guid: 80ca1bec2c07531428cf5a84624e44a4, type: 2} spyInteractions: - {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2} - GlowColor: {r: 0, g: 0, b: 1, a: 0} currentState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2} remainState: {fileID: 0} navMeshAgent: {fileID: 0} diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/IdleClickAction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/IdleClickAction.cs index c0a2dc1..d76d322 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/IdleClickAction.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/IdleClickAction.cs @@ -15,6 +15,7 @@ public class IdleClickAction : Action controller.SelectedInteraction = null; controller.Interactor = null; controller.SelectedObject = null; + controller.characterAnimator.SetBool(CharacterAnimator.Params.Interacting, false); } public override void Act(StateController controller) diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcInteractAction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcInteractAction.cs new file mode 100644 index 0000000..92a2ed0 --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcInteractAction.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +[CreateAssetMenu(menuName = "CharacterStateMachine/Actions/NpcInteract")] +public class NpcInteractAction : Action +{ + public override void StartAct(StateController controller) + { + controller.characterAnimator.SetTrigger(controller.SelectedInteraction.initiatorAnimationTrigger); + controller.characterAnimator.SetBool(CharacterAnimator.Params.Interacting, true); + controller.MoveForSelectedObjectInteraction(); + } + + public override void Act(StateController controller) + { + controller.FaceSelectedObject(); + } + + public override void EndAct(StateController controller) + { + controller.FinishInteraction(); + } +} + diff --git a/Project Undercover/Assets/Scripts/Glow/GlowObject.cs.meta b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcInteractAction.cs.meta similarity index 76% rename from Project Undercover/Assets/Scripts/Glow/GlowObject.cs.meta rename to Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcInteractAction.cs.meta index e4f1f9f..751001f 100644 --- a/Project Undercover/Assets/Scripts/Glow/GlowObject.cs.meta +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcInteractAction.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: d597e878c9aa5f1478d29321afbd8919 -timeCreated: 1507020555 +guid: acbb53bdc7aa18d45a61fd8bac4ed071 +timeCreated: 1507584725 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcWaitForInteractionAcceptanceAction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcWaitForInteractionAcceptanceAction.cs new file mode 100644 index 0000000..24fcc26 --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcWaitForInteractionAcceptanceAction.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +[CreateAssetMenu(menuName = "CharacterStateMachine/Actions/NpcWaitForInteractionAcceptance")] +public class NpcWaitForInteractionAcceptanceAction : Action +{ + + public override void StartAct(StateController controller) + { + controller.InitiateInteractionWithSelectedObject(); + //controller.Destination = controller.SelectedObject.transform.position; + } +} + diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcWaitForInteractionAcceptanceAction.cs.meta b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcWaitForInteractionAcceptanceAction.cs.meta new file mode 100644 index 0000000..a5ffaf5 --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/NpcWaitForInteractionAcceptanceAction.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73193a69302e61643a42134080a61e99 +timeCreated: 1507587780 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/RoamAction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/RoamAction.cs index 2711fdb..7e89328 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/RoamAction.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/RoamAction.cs @@ -9,13 +9,13 @@ public class RoamAction : Action { // Debug.Log("Started Roaming"); controller.StartRoaming(); + controller.characterAnimator.SetBool(CharacterAnimator.Params.Interacting, false); } public override void Act(StateController controller) { - if (controller.Interactor != null && !controller.IsInteracting) + if (controller.Interactor != null && !controller.IsInteracting && InRangeOfInteractor(controller)) { - // Debug.Log("Accepting incomming interaction!"); controller.AcceptInteraction(); } } @@ -25,4 +25,9 @@ public class RoamAction : Action // Debug.Log("Stopping coroutine"); controller.StopRoaming(); } + + private bool InRangeOfInteractor(StateController controller) + { + return (controller.Interactor.transform.position - controller.transform.position).magnitude < StateController.INTERACT_RANGE; + } } diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/SpyInteractAction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/SpyInteractAction.cs index a9de47e..552a5ae 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/SpyInteractAction.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/SpyInteractAction.cs @@ -6,18 +6,16 @@ public class SpyInteractAction : Action { public override void StartAct(StateController controller) { - controller.characterAnimator.SetTrigger(controller.SelectedInteraction.characterInteraction); - Vector3 awayDirection =(controller.transform.position - controller.SelectedObject.transform.position).normalized; - Vector3 newPos = controller.SelectedObject.transform.position + awayDirection * controller.SelectedInteraction.interactionDistance; - controller.navMeshAgent.stoppingDistance = 0.0f; - controller.Destination = newPos; + controller.characterAnimator.SetTrigger(controller.SelectedInteraction.initiatorAnimationTrigger); + controller.characterAnimator.SetBool(CharacterAnimator.Params.Interacting, true); + controller.MoveForSelectedObjectInteraction(); } public override void Act(StateController controller) { controller.FaceSelectedObject(); AnimatorStateInfo info = controller.animator.GetCurrentAnimatorStateInfo(0); - if (info.IsName(CharacterAnimator.GetParamName(controller.SelectedInteraction.characterInteraction))) + if (info.IsName(CharacterAnimator.GetParamName(controller.SelectedInteraction.initiatorAnimationTrigger))) { float progress = info.normalizedTime; ProgressPanelController.ActivePanel.Progress = progress; diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitForInteractionAcceptance.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitForInteractionAcceptance.cs index 633512f..d3711bf 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitForInteractionAcceptance.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitForInteractionAcceptance.cs @@ -8,17 +8,5 @@ public class WaitForInteractionAcceptance : Action controller.InitiateInteractionWithSelectedObject(); ProgressPanelController.ActivePanel.Reveal(controller.SelectedInteraction.interactionDescription); } - - public override void EndAct(StateController controller) - { - //Debug.Log("Finished waiting for acceptance"); - } - - private Interaction GetFirstInteraction(StateController controller) - { - if (controller.SelectedObject.interactions.Length > 0) - return controller.SelectedObject.interactions[0]; - return controller.SelectedObject.spyInteractions[0]; - } } diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitInPlaceAction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitInPlaceAction.cs index 346d0a8..6bfa400 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitInPlaceAction.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/WaitInPlaceAction.cs @@ -11,6 +11,8 @@ public class WaitInPlaceAction : Action { if (!controller.IsInteracting) controller.IsInteracting = true; controller.Destination = controller.transform.position; + controller.characterAnimator.SetBool(CharacterAnimator.Params.Interacting, true); + controller.characterAnimator.SetTrigger(controller.Interactor.SelectedInteraction.objectAnimationTrigger); } public override void Act(StateController controller) @@ -25,5 +27,4 @@ public class WaitInPlaceAction : Action { controller.Interactor.characterAnimator.SetTrigger(CharacterAnimator.Params.Interrupted); controller.Interactor = null; } - } diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/CharacterAnimator.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/CharacterAnimator.cs index c050df0..5a1d54f 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/CharacterAnimator.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/CharacterAnimator.cs @@ -9,7 +9,7 @@ public class CharacterAnimator : Photon.PunBehaviour public enum Params { - Idle, MoveSpeed, PassingMessage, Interrupted, Wave + Idle, MoveSpeed, PassingMessage, Interrupted, Wave, Acknowledging, Handshake, Interacting, Bow } protected virtual void Awake() @@ -55,6 +55,16 @@ public class CharacterAnimator : Photon.PunBehaviour photonView.RPC("SetTriggerRPC", PhotonTargets.All, paramHashes[(int)param], true); } + public bool GetBool(Params param) + { + return animator.GetBool(paramHashes[(int)param]); + } + + public void SetBool(Params param, bool value) + { + photonView.RPC("SetBoolRPC", PhotonTargets.All, paramHashes[(int)param], value); + } + public void ResetTrigger(Params param) { photonView.RPC("SetTriggerRPC", PhotonTargets.All, paramHashes[(int)param], false); diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InitiatedInteractionDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InitiatedInteractionDecision.cs index b7be89e..cf07801 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InitiatedInteractionDecision.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InitiatedInteractionDecision.cs @@ -1,6 +1,4 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; [CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/InitiatedInteraction")] public class InitiatedInteractionDecision : Decision diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InterruptedDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InterruptedDecision.cs index 106e0cb..f71b888 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InterruptedDecision.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/InterruptedDecision.cs @@ -7,11 +7,6 @@ public class InterruptedDecision : Decision { public override bool Decide(StateController controller) { - if (controller.characterAnimator.GetTrigger(CharacterAnimator.Params.Interrupted)) - { - Debug.Log("Interrupted"); - return true; - } - return false; + return controller.characterAnimator.GetTrigger(CharacterAnimator.Params.Interrupted); } } diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/IsInteractingDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/IsInteractingDecision.cs index d27aa86..0314870 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/IsInteractingDecision.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/IsInteractingDecision.cs @@ -7,6 +7,6 @@ public class IsInteractingDecision : Decision { public override bool Decide(StateController controller) { - return controller.IsInteracting; + return controller.IsInteracting && controller.Interactor != null; } } \ No newline at end of file diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ObjectDeclinedInteractionDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ObjectDeclinedInteractionDecision.cs index 21a9d99..92b724c 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ObjectDeclinedInteractionDecision.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ObjectDeclinedInteractionDecision.cs @@ -5,7 +5,7 @@ using System.Text; using UnityEngine; [CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/ObjectDeclinedInteraction")] -class ObjectDeclinedInteractionDecision : Decision +public class ObjectDeclinedInteractionDecision : Decision { public override bool Decide(StateController controller) { diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ReceivingInteractionDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ReceivingInteractionDecision.cs new file mode 100644 index 0000000..6b83faf --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ReceivingInteractionDecision.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +[CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/ReceivingInteraction")] +public class ReceivingInteractionDecision : Decision +{ + public override bool Decide(StateController controller) + { + return controller.Interactor != null; + } +} \ No newline at end of file diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ReceivingInteractionDecision.cs.meta b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ReceivingInteractionDecision.cs.meta new file mode 100644 index 0000000..c8485ba --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/ReceivingInteractionDecision.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5998aa6b572affe4a98a2e05c3ad4f0b +timeCreated: 1507590145 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/SelectedObjectDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/SelectedObjectDecision.cs new file mode 100644 index 0000000..165947c --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/SelectedObjectDecision.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +[CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/SelectedObject")] +public class SelectedObjectDecision : Decision +{ + public override bool Decide(StateController controller) + { + return controller.SelectedObject != null && controller.SelectedInteraction != null; + } +} + diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/SelectedObjectDecision.cs.meta b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/SelectedObjectDecision.cs.meta new file mode 100644 index 0000000..0811f5f --- /dev/null +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/SelectedObjectDecision.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 857349843f32b194e9bf5d2fe22ca2fc +timeCreated: 1507584964 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/WaitForTransitionDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/WaitForTransitionDecision.cs index 8c1f209..fd0177b 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/WaitForTransitionDecision.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/WaitForTransitionDecision.cs @@ -7,7 +7,7 @@ public class WaitForTransitionDecision : Decision { public override bool Decide(StateController controller) { - string fromState = CharacterAnimator.GetParamName(controller.SelectedInteraction.characterInteraction); + string fromState = CharacterAnimator.GetParamName(controller.SelectedInteraction.initiatorAnimationTrigger); string toState = CharacterAnimator.GetParamName(CharacterAnimator.Params.Idle); string transitionName = fromState + " -> " + toState; var currentTransition = controller.animator.GetAnimatorTransitionInfo(0); diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/YouAcceptedInteractionDecision.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/YouAcceptedInteractionDecision.cs index c2fa1a7..c1bd9d5 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/YouAcceptedInteractionDecision.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/DecisionScripts/YouAcceptedInteractionDecision.cs @@ -5,7 +5,7 @@ using System.Text; using UnityEngine; [CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/YouAcceptedInteraction")] -class YouAcceptedInteractionDecision : Decision +public class YouAcceptedInteractionDecision : Decision { public override bool Decide(StateController controller) { diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs index 2ee5964..34e3f41 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs @@ -8,7 +8,7 @@ public class Interaction : ScriptableObject public string interactionDescription; [Tooltip("Descriptions follow the prompt \"Press 'E' to ...\"")] public string receiverDescription; - public CharacterAnimator.Params characterInteraction; + public CharacterAnimator.Params initiatorAnimationTrigger, objectAnimationTrigger; public InteractionResult result; public float initialRotation; public float objectInitialRotation; @@ -18,11 +18,11 @@ public class Interaction : ScriptableObject { Nothing, SpyMissionComplete } - + /* public override int GetHashCode() { return interactionDescription.GetHashCode() ^ (int)characterInteraction; - } + }*/ public void ExecuteResult(StateController controller) { diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/SelectableObject.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/SelectableObject.cs index b215f5d..fd7d851 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/SelectableObject.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/SelectableObject.cs @@ -17,6 +17,7 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable objects; private Color AvailableColor, InteractingColor; private bool isMousedOver = false; @@ -74,6 +75,9 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable(); + objects.Add(this); isSpy = CompareTag("Spy"); Renderers = GetComponentsInChildren(); AvailableColor = Color.green; @@ -84,6 +88,11 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable 0; } + public bool HasNpcInteractions() + { + return (interactions.Length) > 0; + } + + public bool HasSpyInteractions() + { + return (spyInteractions.Length) > 0; + } + + public Interaction GetRandomNpcInteraction() + { + if (interactions.Length <= 0) + Debug.LogError("Attempted to get a random npc interaction when " + name + " doesn't have any"); + + int randomIndex = UnityEngine.Random.Range(0, interactions.Length); + return interactions[randomIndex]; + } + public virtual string GetInteractionTitle() { return ""; @@ -151,6 +180,7 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable 0.5f) + { + SelectableObject randomObject = GetRandomAvailableSelectableObject(); + if (randomObject != null) + { + SelectedObject = randomObject; + IsInteracting = true; + Interaction randomInteraction = SelectedObject.GetRandomNpcInteraction(); + SelectedInteraction = randomInteraction; + Debug.Log(SelectedObject.name); + yield return null; + } + } Destination = GetRandomLocation(); } } + private SelectableObject GetRandomAvailableSelectableObject(int tries=0) + { + int randomIndex = UnityEngine.Random.Range(0, objects.Count); + SelectableObject randomObject = objects[randomIndex]; + if (randomObject == this && randomObject.HasNpcInteractions() && !randomObject.Interactor && !randomObject.IsInteracting) + { + if (tries < 3) + return GetRandomAvailableSelectableObject(tries++); + else + return null; + } + + return objects[randomIndex]; + } + public void FaceSelectedObject() { float progress = animator.GetCurrentAnimatorStateInfo(0).normalizedTime; @@ -257,4 +283,12 @@ public class StateController : SelectableObject transform.rotation = Quaternion.Slerp(transform.rotation, facingRotation, Time.deltaTime * 10.0f); } } + + public void MoveForSelectedObjectInteraction() + { + Vector3 awayDirection = (transform.position - SelectedObject.transform.position).normalized; + Vector3 newPos = SelectedObject.transform.position + awayDirection * SelectedInteraction.interactionDistance; + navMeshAgent.stoppingDistance = 0.0f; + Destination = newPos; + } } diff --git a/Project Undercover/Assets/Scripts/Glow/GlowObject.cs b/Project Undercover/Assets/Scripts/Glow/GlowObject.cs deleted file mode 100644 index d7d144f..0000000 --- a/Project Undercover/Assets/Scripts/Glow/GlowObject.cs +++ /dev/null @@ -1,64 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; - -public class GlowObject : MonoBehaviour -{ - public Color GlowColor; - public float LerpFactor = 10; - - public Renderer[] Renderers - { - get; - private set; - } - - public Color CurrentColor - { - get { return _currentColor; } - } - - private List _materials = new List(); - private Color _currentColor; - private Color _targetColor; - - protected virtual void Start() - { - Renderers = GetComponentsInChildren(); - - foreach (var renderer in Renderers) - { - _materials.AddRange(renderer.materials); - } - } - - protected void OnMouseEnter() - { - _targetColor = GlowColor; - enabled = true; - } - - protected void OnMouseExit() - { - _targetColor = Color.black; - _targetColor.a = 0.0f; - enabled = true; - } - - /// - /// Loop over all cached materials and update their color, disable self if we reach our target color. - /// - protected void Update() - { - _currentColor = Color.Lerp(_currentColor, _targetColor, Time.deltaTime * LerpFactor); - - for (int i = 0; i < _materials.Count; i++) - { - _materials[i].SetColor("_GlowColor", _currentColor); - } - - if (_currentColor.Equals(_targetColor)) - { - enabled = false; - } - } -}