basics for interactions are now very stable

This commit is contained in:
Steven 2017-10-09 02:03:39 -05:00
parent ed145ddc56
commit 2a3c2839d5
79 changed files with 1965 additions and 124 deletions

View file

@ -13,19 +13,25 @@ AnimatorController:
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 0}
- m_Name: Interrupted - m_Name: Interrupted
m_Type: 9 m_Type: 9
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 0}
- m_Name: PassingMessage - m_Name: PassingMessage
m_Type: 9 m_Type: 9
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 0}
- m_Name: Wave
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Base Layer m_Name: Base Layer
@ -242,6 +248,51 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1101 &1101398582299456848
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.82954544
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101403792724398678
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.82954544
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101775513785162602 --- !u!1101 &1101775513785162602
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 3 m_ObjectHideFlags: 3
@ -266,6 +317,30 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1101 &1101864097741464978
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Wave
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102575800090953688}
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!1102 &1102075779692729400 --- !u!1102 &1102075779692729400
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 5
@ -304,6 +379,7 @@ AnimatorState:
- {fileID: 1101240174848402812} - {fileID: 1101240174848402812}
- {fileID: 1101154328280627494} - {fileID: 1101154328280627494}
- {fileID: 1101234958992700582} - {fileID: 1101234958992700582}
- {fileID: 1101864097741464978}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0} m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0 m_IKOnFeet: 0
@ -317,6 +393,31 @@ AnimatorState:
m_SpeedParameter: m_SpeedParameter:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
--- !u!1102 &1102575800090953688
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Wave
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 1101398582299456848}
- {fileID: 1101403792724398678}
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: 4377a1c3a58a44747b33d73506e3d858, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
--- !u!1102 &1102660636531336150 --- !u!1102 &1102660636531336150
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 5
@ -359,6 +460,9 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 1102150790202348572} m_State: {fileID: 1102150790202348572}
m_Position: {x: 348, y: 120, z: 0} m_Position: {x: 348, y: 120, z: 0}
- serializedVersion: 1
m_State: {fileID: 1102575800090953688}
m_Position: {x: 588, y: 12, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []

View file

@ -0,0 +1,319 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1712754431308494}
m_IsPrefabParent: 1
--- !u!1 &1363781139966340
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224531806016218054}
- component: {fileID: 222940000257781502}
- component: {fileID: 114523001061847092}
m_Layer: 5
m_Name: Item Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1618822445019746
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224048300615382840}
- component: {fileID: 222727721632994402}
- component: {fileID: 114672679117268906}
m_Layer: 5
m_Name: Item Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1712754431308494
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224495458828153612}
- component: {fileID: 114209797991797522}
- component: {fileID: 114090458887756884}
m_Layer: 5
m_Name: InteractionItem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1746095561317838
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224275517958138616}
- component: {fileID: 222059009440653190}
- component: {fileID: 114182452800898590}
m_Layer: 5
m_Name: Item Checkmark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114090458887756884
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1712754431308494}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a504f94575329234aa42f32c65d42f3e, type: 3}
m_Name:
m_EditorClassIdentifier:
label: {fileID: 114523001061847092}
background: {fileID: 114672679117268906}
--- !u!114 &114182452800898590
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1746095561317838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114209797991797522
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1712754431308494}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 2109663825, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 114672679117268906}
toggleTransition: 1
graphic: {fileID: 114182452800898590}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!114 &114523001061847092
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1363781139966340}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!114 &114672679117268906
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1618822445019746}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &222059009440653190
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1746095561317838}
--- !u!222 &222727721632994402
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1618822445019746}
--- !u!222 &222940000257781502
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1363781139966340}
--- !u!224 &224048300615382840
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1618822445019746}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224495458828153612}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224275517958138616
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1746095561317838}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224495458828153612}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224495458828153612
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1712754431308494}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224048300615382840}
- {fileID: 224275517958138616}
- {fileID: 224531806016218054}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224531806016218054
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1363781139966340}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224495458828153612}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 5, y: -0.5}
m_SizeDelta: {x: -30, y: -3}
m_Pivot: {x: 0.5, y: 0.5}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d3817b0301d837042a84f22cbeba3abe
timeCreated: 1507513530
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -355,7 +355,6 @@ GameObject:
- component: {fileID: 114492707522239788} - component: {fileID: 114492707522239788}
- component: {fileID: 114063469203119278} - component: {fileID: 114063469203119278}
- component: {fileID: 136748321063637496} - component: {fileID: 136748321063637496}
- component: {fileID: 114503176627609734}
- component: {fileID: 114776369420944768} - component: {fileID: 114776369420944768}
m_Layer: 10 m_Layer: 10
m_Name: NPC m_Name: NPC
@ -2153,26 +2152,15 @@ MonoBehaviour:
_queuedInteractorId: -1 _queuedInteractorId: -1
_isInteracting: 0 _isInteracting: 0
interactions: interactions:
- {fileID: 11400000, guid: 01a3cf8545fc70f4c90095f144ac9b01, type: 2}
spyInteractions:
- {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2} - {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2}
spyInteractions: [] GlowColor: {r: 0, g: 1, b: 0, a: 0}
currentState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} currentState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2}
remainState: {fileID: 11400000, guid: 5eb84557ff3e09f42b843e0b09653774, type: 2} remainState: {fileID: 0}
navMeshAgent: {fileID: 0} navMeshAgent: {fileID: 0}
animator: {fileID: 0} animator: {fileID: 0}
characterAnimator: {fileID: 0} characterAnimator: {fileID: 0}
--- !u!114 &114503176627609734
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1249949894527080}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d597e878c9aa5f1478d29321afbd8919, type: 3}
m_Name:
m_EditorClassIdentifier:
GlowColor: {r: 0, g: 1, b: 0.006896496, a: 0}
LerpFactor: 10
--- !u!114 &114776369420944768 --- !u!114 &114776369420944768
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View file

@ -65,4 +65,5 @@ MonoBehaviour:
- SetTriggerRPC - SetTriggerRPC
- SetInteractorRPC - SetInteractorRPC
- SetIsInteractingRPC - SetIsInteractingRPC
- SetSelectedInteractionRPC
DisableAutoOpenWizard: 1 DisableAutoOpenWizard: 1

View file

@ -11,8 +11,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3} m_Script: {fileID: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3}
m_Name: TellSecret m_Name: TellSecret
m_EditorClassIdentifier: m_EditorClassIdentifier:
interactionDescription: Telling Secret... interactionDescription: tell a secret
characterInteraction: 1 receiverDescription: listen to a secret
characterInteraction: 2
result: 1 result: 1
initialRotation: -60 initialRotation: -60
objectInitialRotation: -60 objectInitialRotation: -60
interactionDistance: 1

View file

@ -0,0 +1,20 @@
%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: Wave
m_EditorClassIdentifier:
interactionDescription: wave
receiverDescription: wave back
characterInteraction: 4
result: 0
initialRotation: 0
objectInitialRotation: 0
interactionDistance: 1

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 01a3cf8545fc70f4c90095f144ac9b01
timeCreated: 1507510889
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -2151,11 +2151,13 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_queuedInteractorId: -1 _queuedInteractorId: -1
_isInteracting: 0 _isInteracting: 0
interactions: [] interactions:
- {fileID: 11400000, guid: 01a3cf8545fc70f4c90095f144ac9b01, type: 2}
spyInteractions: spyInteractions:
- {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2} - {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2}
GlowColor: {r: 0, g: 0, b: 1, a: 0}
currentState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2} currentState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2}
remainState: {fileID: 11400000, guid: 5eb84557ff3e09f42b843e0b09653774, type: 2} remainState: {fileID: 0}
navMeshAgent: {fileID: 0} navMeshAgent: {fileID: 0}
animator: {fileID: 0} animator: {fileID: 0}
characterAnimator: {fileID: 0} characterAnimator: {fileID: 0}

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
using UnityEngine.EventSystems;
[CreateAssetMenu(menuName = "CharacterStateMachine/Actions/IdleClick")] [CreateAssetMenu(menuName = "CharacterStateMachine/Actions/IdleClick")]
public class IdleClickAction : Action public class IdleClickAction : Action
@ -18,18 +19,20 @@ public class IdleClickAction : Action
public override void Act(StateController controller) public override void Act(StateController controller)
{ {
// Decline interactions here if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
if (Input.GetKeyDown(KeyCode.D))
controller.Interactor = null;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Input.GetMouseButtonDown(0))
{ {
if (controller.Interactor)
{
controller.Interactor = null;
InteractionPanelController.ActivePanel.Hide();
}
else
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// Check first if the player clicked on a selectable object // Check first if the player clicked on a selectable object
SelectableObject selectableObject; SelectableObject selectableObject;
if (RaycastForSelectableObject(controller, ray, out selectableObject)) if (RaycastForSelectableObject(controller, ray, out selectableObject))
{ {
// Debug.Log("Selected object set to " + selectableObject.name);
controller.SelectedObject = selectableObject; controller.SelectedObject = selectableObject;
return; return;
} }
@ -39,6 +42,9 @@ public class IdleClickAction : Action
controller.SelectedObject = null; controller.SelectedObject = null;
RaycastToMoveController(controller, ray); RaycastToMoveController(controller, ray);
} }
}
// If the player has selected an object, move the player toward that object
if (controller.SelectedObject && !controller.IsInteracting) if (controller.SelectedObject && !controller.IsInteracting)
controller.Destination = controller.SelectedObject.transform.position; controller.Destination = controller.SelectedObject.transform.position;
} }

View file

@ -7,24 +7,23 @@ public class PromptInteractionsAction : Action {
public override void Act(StateController controller) public override void Act(StateController controller)
{ {
string objectInteractionText = "Press 'E' to interact with ";
if (ReceivedInteraction(controller)) if (ReceivedInteraction(controller))
{ {
InteractionPanelController.Reveal(controller.Interactor.name/* + " is trying to " + controller.Interactor.SelectedInteraction.interactionDescription*/); InteractionPanelController.ActivePanel.AcceptInteractionReveal(controller);
} }
else if (SelectedObjectAvailable(controller)) else if (SelectedObjectAvailable(controller))
{ {
InteractionPanelController.Reveal(objectInteractionText + controller.SelectedObject.name); InteractionPanelController.ActivePanel.SelectInteractionReveal(controller);
} }
else else
{ {
InteractionPanelController.Hide(); //InteractionPanelController.Hide();
} }
} }
public override void EndAct(StateController controller) public override void EndAct(StateController controller)
{ {
InteractionPanelController.Hide(); InteractionPanelController.ActivePanel.Hide();
} }
// Other controller is attempting to interact with this controller // Other controller is attempting to interact with this controller

View file

@ -5,8 +5,6 @@ public class WaitForInteractionAcceptance : Action
{ {
public override void StartAct(StateController controller) public override void StartAct(StateController controller)
{ {
// Todo: Remove this line once the "interaction selector" UI is finished
controller.SelectedInteraction = GetFirstInteraction(controller);
controller.InitiateInteractionWithSelectedObject(); controller.InitiateInteractionWithSelectedObject();
ProgressPanelController.ActivePanel.Reveal(controller.SelectedInteraction.interactionDescription); ProgressPanelController.ActivePanel.Reveal(controller.SelectedInteraction.interactionDescription);
} }

View file

@ -9,7 +9,7 @@ public class CharacterAnimator : Photon.PunBehaviour
public enum Params public enum Params
{ {
MoveSpeed = 0, PassingMessage, Interrupted Idle, MoveSpeed, PassingMessage, Interrupted, Wave
} }
protected virtual void Awake() protected virtual void Awake()

View file

@ -9,6 +9,7 @@ public class InitiatedInteractionDecision : Decision
{ {
return Input.GetKeyDown(KeyCode.E) && return Input.GetKeyDown(KeyCode.E) &&
InteractionPanelController.InteractionPrompted() && InteractionPanelController.InteractionPrompted() &&
controller.SelectedObject != null; controller.SelectedObject != null &&
controller.SelectedInteraction != null;
} }
} }

View file

@ -5,10 +5,10 @@ using UnityEngine;
[CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/WaitForTransition")] [CreateAssetMenu(menuName = "CharacterStateMachine/Decisions/WaitForTransition")]
public class WaitForTransitionDecision : Decision public class WaitForTransitionDecision : Decision
{ {
public string fromState, toState;
public override bool Decide(StateController controller) public override bool Decide(StateController controller)
{ {
string fromState = CharacterAnimator.GetParamName(controller.SelectedInteraction.characterInteraction);
string toState = CharacterAnimator.GetParamName(CharacterAnimator.Params.Idle);
string transitionName = fromState + " -> " + toState; string transitionName = fromState + " -> " + toState;
var currentTransition = controller.animator.GetAnimatorTransitionInfo(0); var currentTransition = controller.animator.GetAnimatorTransitionInfo(0);
if (currentTransition.IsName(transitionName)) if (currentTransition.IsName(transitionName))

View file

@ -4,7 +4,10 @@
public class Interaction : ScriptableObject public class Interaction : ScriptableObject
{ {
// Animation performed by the character // Animation performed by the character
[Tooltip("Descriptions follow the prompt \"Press 'E' to ...\"")]
public string interactionDescription; public string interactionDescription;
[Tooltip("Descriptions follow the prompt \"Press 'E' to ...\"")]
public string receiverDescription;
public CharacterAnimator.Params characterInteraction; public CharacterAnimator.Params characterInteraction;
public InteractionResult result; public InteractionResult result;
public float initialRotation; public float initialRotation;
@ -16,6 +19,11 @@ public class Interaction : ScriptableObject
Nothing, SpyMissionComplete Nothing, SpyMissionComplete
} }
public override int GetHashCode()
{
return interactionDescription.GetHashCode() ^ (int)characterInteraction;
}
public void ExecuteResult(StateController controller) public void ExecuteResult(StateController controller)
{ {
switch(result) switch(result)

View file

@ -17,33 +17,37 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable<Selecta
// Interactions only spies can perform on this object // Interactions only spies can perform on this object
public Interaction[] spyInteractions; public Interaction[] spyInteractions;
public virtual void Selected()
private Color AvailableColor, InteractingColor;
private bool isMousedOver = false;
private float LerpFactor = 10;
private List<Material> _materials = new List<Material>();
private Color _currentColor;
private bool isSpy;
public Renderer[] Renderers
{ {
get;
private set;
} }
public virtual void Deselected() public Color CurrentColor
{ {
get { return _currentColor; }
} }
public virtual void Update() public bool IsInteracting
{ {
if (Interactor != null) get
{ {
AcceptInteraction(); return _isInteracting;
}
set
{
photonView.RPC("SetIsInteractingRPC", PhotonTargets.All, value);
} }
} }
public bool HasInteractions()
{
return (interactions.Length + spyInteractions.Length) > 0;
}
public virtual string GetInteractionTitle()
{
return "";
}
// Manages other StateControllers signalling this controller for an interaction
public StateController Interactor public StateController Interactor
{ {
get get
@ -68,6 +72,83 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable<Selecta
} }
} }
protected virtual void Start()
{
isSpy = CompareTag("Spy");
Renderers = GetComponentsInChildren<Renderer>();
AvailableColor = Color.green;
InteractingColor = Color.yellow;
foreach (var renderer in Renderers)
{
_materials.AddRange(renderer.materials);
}
}
public Color TargetColor
{
get
{
if (isMousedOver)
{
if (Interactor)
return InteractingColor;
else
return AvailableColor;
}
else
{
Color color = Color.black;
color.a = 0.0f;
return color;
}
}
}
protected virtual void Update()
{
_currentColor = Color.Lerp(_currentColor, TargetColor, Time.deltaTime * LerpFactor);
for (int i = 0; i < _materials.Count; i++)
{
_materials[i].SetColor("_GlowColor", _currentColor);
}
if (Interactor != null && !isSpy)
AcceptInteraction();
}
private void OnMouseEnter()
{
if (!isSpy)
isMousedOver = true;
else if (!photonView.isMine)
isMousedOver = true;
}
private void OnMouseExit()
{
isMousedOver = false;
}
public virtual void Selected()
{
}
public virtual void Deselected()
{
}
public bool HasInteractions()
{
return (interactions.Length + spyInteractions.Length) > 0;
}
public virtual string GetInteractionTitle()
{
return "";
}
public void AcceptInteraction() public void AcceptInteraction()
{ {
IsInteracting = true; IsInteracting = true;
@ -78,17 +159,6 @@ public abstract class SelectableObject : Photon.PunBehaviour, IEquatable<Selecta
Interactor.IsInteracting = false; Interactor.IsInteracting = false;
} }
public bool IsInteracting {
get
{
return _isInteracting;
}
set
{
photonView.RPC("SetIsInteractingRPC", PhotonTargets.All, value);
}
}
[PunRPC] [PunRPC]
protected void SetIsInteractingRPC(bool value) protected void SetIsInteractingRPC(bool value)
{ {

View file

@ -35,14 +35,16 @@ public class StateController : SelectableObject
characterAnimator = GetComponent<CharacterAnimator>(); characterAnimator = GetComponent<CharacterAnimator>();
} }
public void Start() protected override void Start()
{ {
base.Start();
if (photonView.isMine) if (photonView.isMine)
currentState.DoStartActions(this); currentState.DoStartActions(this);
} }
public override void Update() protected override void Update()
{ {
base.Update();
if (photonView.isMine) if (photonView.isMine)
{ {
currentState.UpdateState(this); currentState.UpdateState(this);
@ -108,7 +110,9 @@ public class StateController : SelectableObject
set set
{ {
if (_selectedObject != null) if (_selectedObject != null)
{
_selectedObject.Deselected(); _selectedObject.Deselected();
}
_selectedObject = value; _selectedObject = value;
if (_selectedObject != null) if (_selectedObject != null)
{ {
@ -156,7 +160,10 @@ public class StateController : SelectableObject
if (SelectedObject) if (SelectedObject)
{ {
if (SelectedObject.IsInteracting) if (SelectedObject.IsInteracting)
{
SelectedObject.IsInteracting = false; SelectedObject.IsInteracting = false;
}
SelectedObject.Interactor = null;
SelectedObject = null; SelectedObject = null;
} }
} }
@ -169,10 +176,28 @@ public class StateController : SelectableObject
} }
set set
{ {
_selectedInteraction = value; int hash = 0;
if (value != null)
hash = value.GetHashCode();
photonView.RPC("SetSelectedInteractionRPC", PhotonTargets.All, hash);
} }
} }
[PunRPC]
private void SetSelectedInteractionRPC(int hash)
{
Interaction[] foundInteractions = (Interaction[])Resources.FindObjectsOfTypeAll(typeof(Interaction));
foreach (var interaction in foundInteractions)
{
if (interaction.GetHashCode() == hash)
{
_selectedInteraction = interaction;
return;
}
}
_selectedInteraction = null;
}
public void StartRoaming() public void StartRoaming()
{ {
_roamCoroutine = StartCoroutine(Roam()); _roamCoroutine = StartCoroutine(Roam());
@ -203,7 +228,7 @@ public class StateController : SelectableObject
public void FaceInteractor() public void FaceInteractor()
{ {
if (Interactor == null) if (Interactor == null)
Debug.LogError("Cannot face a null Interactor"); return;
float progress = Interactor.animator.GetCurrentAnimatorStateInfo(0).normalizedTime; float progress = Interactor.animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
Vector3 otherPos = Interactor.transform.position; Vector3 otherPos = Interactor.transform.position;
@ -225,11 +250,11 @@ public class StateController : SelectableObject
if (progress < _startInteractionProgressLimit) if (progress < _startInteractionProgressLimit)
{ {
Quaternion adjustedRotation = facingRotation * Quaternion.Euler(0, initialRotation, 0); Quaternion adjustedRotation = facingRotation * Quaternion.Euler(0, initialRotation, 0);
transform.rotation = Quaternion.Slerp(transform.rotation, adjustedRotation, Time.deltaTime * 5.0f); transform.rotation = Quaternion.Slerp(transform.rotation, adjustedRotation, Time.deltaTime * 10.0f);
} }
else else
{ {
transform.rotation = Quaternion.Slerp(transform.rotation, facingRotation, Time.deltaTime * 5.0f); transform.rotation = Quaternion.Slerp(transform.rotation, facingRotation, Time.deltaTime * 10.0f);
} }
} }
} }

View file

@ -21,7 +21,7 @@ public class GlowObject : MonoBehaviour
private Color _currentColor; private Color _currentColor;
private Color _targetColor; private Color _targetColor;
void Start() protected virtual void Start()
{ {
Renderers = GetComponentsInChildren<Renderer>(); Renderers = GetComponentsInChildren<Renderer>();
@ -31,13 +31,13 @@ public class GlowObject : MonoBehaviour
} }
} }
private void OnMouseEnter() protected void OnMouseEnter()
{ {
_targetColor = GlowColor; _targetColor = GlowColor;
enabled = true; enabled = true;
} }
private void OnMouseExit() protected void OnMouseExit()
{ {
_targetColor = Color.black; _targetColor = Color.black;
_targetColor.a = 0.0f; _targetColor.a = 0.0f;
@ -47,7 +47,7 @@ public class GlowObject : MonoBehaviour
/// <summary> /// <summary>
/// Loop over all cached materials and update their color, disable self if we reach our target color. /// Loop over all cached materials and update their color, disable self if we reach our target color.
/// </summary> /// </summary>
private void Update() protected void Update()
{ {
_currentColor = Color.Lerp(_currentColor, _targetColor, Time.deltaTime * LerpFactor); _currentColor = Color.Lerp(_currentColor, _targetColor, Time.deltaTime * LerpFactor);

View file

@ -6,8 +6,7 @@ public class GuardCamera : Photon.PunBehaviour {
public float xRotation = 0.0f; public float xRotation = 0.0f;
public float yRotation = 0.0f; public float yRotation = 0.0f;
public bool laserSightEnabled = false; public Light spotLight;
private GameObject line;
void Start () { void Start () {
xRotation = transform.eulerAngles.y; xRotation = transform.eulerAngles.y;
@ -18,22 +17,6 @@ public class GuardCamera : Photon.PunBehaviour {
Quaternion newRotation = Quaternion.AngleAxis(xRotation, Vector3.up); Quaternion newRotation = Quaternion.AngleAxis(xRotation, Vector3.up);
newRotation *= Quaternion.AngleAxis(-yRotation, -Vector3.right); newRotation *= Quaternion.AngleAxis(-yRotation, -Vector3.right);
transform.localRotation = Quaternion.Slerp(transform.rotation, newRotation, Time.time * 0.01f); transform.localRotation = Quaternion.Slerp(transform.rotation, newRotation, Time.time * 0.01f);
if (laserSightEnabled)
{
if (line == null)
line = LineDrawer.MakeLine();
RaycastHit hit;
if (Physics.Raycast(transform.position, transform.forward, out hit))
LineDrawer.DrawLine(line, transform.position, hit.point);
else
LineDrawer.DrawLine(line, transform.position, transform.position + transform.forward * 20.0f);
}
else
{
if (line != null)
Destroy(line);
}
} }
public void UpdateRotation() public void UpdateRotation()
@ -51,6 +34,6 @@ public class GuardCamera : Photon.PunBehaviour {
[PunRPC] [PunRPC]
void SetEnabledRPC(bool enabled) void SetEnabledRPC(bool enabled)
{ {
laserSightEnabled = enabled; spotLight.enabled = enabled;
} }
} }

View file

@ -52,7 +52,7 @@ public class GameManager : Photon.PunBehaviour {
} }
else else
{ {
guardCamera.GetComponent<GuardCamera>().laserSightEnabled = true; guardCamera.GetComponent<GuardCamera>().spotLight.enabled = true;
Vector3 randPos = StateController.GetRandomLocation(); Vector3 randPos = StateController.GetRandomLocation();
var spy = PhotonNetwork.Instantiate(spyPrefab.name, randPos, Quaternion.identity, 0); var spy = PhotonNetwork.Instantiate(spyPrefab.name, randPos, Quaternion.identity, 0);

View file

@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UI;
class InteractionItemController : MonoBehaviour
{
[SerializeField]
private Text label;
[SerializeField]
private Image background;
public void SetLabelText(string text)
{
label.text = text;
}
public void SetSpyColor()
{
background.color = Color.yellow;
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a504f94575329234aa42f32c65d42f3e
timeCreated: 1507513336
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -5,25 +5,83 @@ using UnityEngine.UI;
public class InteractionPanelController : MonoBehaviour { public class InteractionPanelController : MonoBehaviour {
public Text interactionText; [SerializeField]
public GameObject mainPanel; private Text interactionText;
[SerializeField]
private GameObject mainPanel;
[SerializeField]
private Dropdown interactionsDropdown;
[SerializeField]
private GameObject interactionItemPrefab;
[SerializeField]
private GameObject requestPanel;
[SerializeField]
private Text requestedInteractionText;
private static InteractionPanelController activePanel; private static InteractionPanelController activePanel;
private List<Dropdown.OptionData> optionsList;
private StateController _controller;
public class InteractionData : Dropdown.OptionData
{
public Interaction interaction;
public bool isSpyInteraction;
public InteractionData(Interaction interaction, bool isSpyInteraction)
{
this.interaction = interaction;
this.isSpyInteraction = isSpyInteraction;
text = interaction.interactionDescription;
if (isSpyInteraction)
text = text + " (Spy)";
}
}
void Start() void Start()
{ {
ActivePanel = this; ActivePanel = this;
optionsList = new List<Dropdown.OptionData>();
Hide(); Hide();
} }
public static void Reveal(string interactionText) public void SelectInteractionReveal(StateController controller)
{ {
ActivePanel.interactionText.text = interactionText; _controller = controller;
if (mainPanel.activeInHierarchy)
return;
interactionsDropdown.ClearOptions();
var optionsList = new List<Dropdown.OptionData>();
foreach (Interaction interaction in controller.SelectedObject.interactions)
{
var data = new InteractionData(interaction, false);
optionsList.Add(data);
}
foreach (Interaction interaction in controller.SelectedObject.spyInteractions)
{
var data = new InteractionData(interaction, true);
optionsList.Add(data);
}
interactionsDropdown.AddOptions(optionsList);
_controller.SelectedInteraction = ((InteractionData)(interactionsDropdown.options[interactionsDropdown.value])).interaction;
ActivePanel.mainPanel.SetActive(true); ActivePanel.mainPanel.SetActive(true);
} }
public static void Hide() public void SetSelectedInteraction()
{ {
ActivePanel.mainPanel.SetActive(false); _controller.SelectedInteraction = ((InteractionData)(interactionsDropdown.options[interactionsDropdown.value])).interaction;
}
public void AcceptInteractionReveal(StateController controller)
{
_controller = controller;
requestPanel.SetActive(true);
string description = controller.Interactor.SelectedInteraction.receiverDescription;
requestedInteractionText.GetComponent<Text>().text = "Press 'E' to " + description; //+ "\n(or press 'D' to decline)";
}
public void Hide()
{
mainPanel.SetActive(false);
requestPanel.SetActive(false);
interactionsDropdown.Hide();
} }
public static InteractionPanelController ActivePanel public static InteractionPanelController ActivePanel