From 6b91eb106911ac0b3389984419dec80ff3590b1c Mon Sep 17 00:00:00 2001 From: Randall Dolifka Date: Wed, 29 Nov 2017 22:29:40 -0600 Subject: [PATCH] Added guard notification and mission log UI; now tracking missions. Things might be broken idk. --- .../Assets/Materials/Half-Transparent UI.mat | 77 +++ .../Materials/Half-Transparent UI.mat.meta | 10 + .../Resources/PhotonServerSettings.asset | 2 + .../ScriptableObjects/Interactions/Wave.asset | 0 .../Assets/Scenes/GameScene.unity | 493 +++++++++++++++++- .../Interfaces/Interaction.cs | 2 +- .../Assets/Scripts/Guard/GuardCamera.cs | 5 - .../Assets/Scripts/Guard/GuardController.cs | 4 +- .../Assets/Scripts/Lobby/GameManager.cs | 9 +- .../Assets/Scripts/MissionTracker.cs | 240 +++++++++ .../Assets/Scripts/MissionTracker.cs.meta | 13 + .../Assets/Scripts/UI/ScorePanelController.cs | 123 ++--- 12 files changed, 888 insertions(+), 90 deletions(-) create mode 100755 Project Undercover/Assets/Materials/Half-Transparent UI.mat create mode 100755 Project Undercover/Assets/Materials/Half-Transparent UI.mat.meta mode change 100644 => 100755 Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset create mode 100755 Project Undercover/Assets/Scripts/MissionTracker.cs create mode 100755 Project Undercover/Assets/Scripts/MissionTracker.cs.meta diff --git a/Project Undercover/Assets/Materials/Half-Transparent UI.mat b/Project Undercover/Assets/Materials/Half-Transparent UI.mat new file mode 100755 index 0000000..50fa0d0 --- /dev/null +++ b/Project Undercover/Assets/Materials/Half-Transparent UI.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Half-Transparent UI + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _ALPHAPREMULTIPLY_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 0 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project Undercover/Assets/Materials/Half-Transparent UI.mat.meta b/Project Undercover/Assets/Materials/Half-Transparent UI.mat.meta new file mode 100755 index 0000000..9b7df77 --- /dev/null +++ b/Project Undercover/Assets/Materials/Half-Transparent UI.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: c70f4e59a2e942a4c9dd52c4b1980eee +timeCreated: 1511804697 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Resources/PhotonServerSettings.asset b/Project Undercover/Assets/Resources/PhotonServerSettings.asset index fa97744..4d0ea09 100755 --- a/Project Undercover/Assets/Resources/PhotonServerSettings.asset +++ b/Project Undercover/Assets/Resources/PhotonServerSettings.asset @@ -75,4 +75,6 @@ MonoBehaviour: - GuardCaughtNPCRPC - ReplaceNPCWithSpyRPC - ReplaceSpyRPC + - CaughtAgentRPC + - CaughtIncorrectRPC DisableAutoOpenWizard: 1 diff --git a/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset b/Project Undercover/Assets/Resources/ScriptableObjects/Interactions/Wave.asset old mode 100644 new mode 100755 diff --git a/Project Undercover/Assets/Scenes/GameScene.unity b/Project Undercover/Assets/Scenes/GameScene.unity index 04fb74a..a85e7d1 100755 --- a/Project Undercover/Assets/Scenes/GameScene.unity +++ b/Project Undercover/Assets/Scenes/GameScene.unity @@ -145,6 +145,7 @@ MonoBehaviour: NPCPrefab: {fileID: 1804278872897102, guid: 05cc23ecb8ac4b147b123c1f3a4b4744, type: 2} cameraRigPrefab: {fileID: 1009033979625728, guid: 1764211b5690c164d82aa46fa4ec707d, type: 2} + missionPanel: {fileID: 1933384739} numNpcs: 10 --- !u!4 &40329370 Transform: @@ -1004,7 +1005,7 @@ Prefab: - target: {fileID: 224003334026830312, guid: c67fa24334c0f364cad8798522e92116, type: 2} propertyPath: m_LocalPosition.y - value: 0 + value: 217.19734 objectReference: {fileID: 0} - target: {fileID: 224424466063770242, guid: c67fa24334c0f364cad8798522e92116, type: 2} @@ -2092,6 +2093,150 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &653680996 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 653680997} + - component: {fileID: 653680998} + - component: {fileID: 653680999} + m_Layer: 0 + m_Name: MissionTracker + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &653680997 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 653680996} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 639.5663, y: 282.21793, z: -2.141474} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &653680998 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 653680996} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38ee639fa49fd4048877470b920e67ab, type: 3} + m_Name: + m_EditorClassIdentifier: + spyMissionLogText: {fileID: 2018902401} + guardNotificationPanel: {fileID: 1213473208} + guardNotificationText: {fileID: 658035871} +--- !u!114 &653680999 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 653680996} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3} + m_Name: + m_EditorClassIdentifier: + ownerId: 0 + group: 0 + OwnerShipWasTransfered: 0 + prefixBackup: -1 + synchronization: 0 + onSerializeTransformOption: 3 + onSerializeRigidBodyOption: 2 + ownershipTransfer: 0 + ObservedComponents: + - {fileID: 0} + ObservedComponentsFoldoutOpen: 1 + viewIdField: 8 + instantiationId: 8 + currentMasterID: -1 + isRuntimeInstantiated: 0 +--- !u!1 &658035869 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 658035870} + - component: {fileID: 658035872} + - component: {fileID: 658035871} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &658035870 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 658035869} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -528, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1213473209} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -528, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &658035871 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 658035869} + 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: 16 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Notification area... +--- !u!222 &658035872 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 658035869} --- !u!1 &678649002 GameObject: m_ObjectHideFlags: 0 @@ -3575,7 +3720,7 @@ Prefab: - target: {fileID: 224003334026830312, guid: c67fa24334c0f364cad8798522e92116, type: 2} propertyPath: m_LocalPosition.y - value: 0 + value: 217.19734 objectReference: {fileID: 0} - target: {fileID: 0} propertyPath: m_Enabled @@ -3852,15 +3997,48 @@ Prefab: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 114606039338021622, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + propertyPath: timerText + value: + objectReference: {fileID: 1184926821} + - target: {fileID: 114606039338021622, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + propertyPath: guardScore + value: + objectReference: {fileID: 1184926820} + - target: {fileID: 114606039338021622, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + propertyPath: spyScore + value: + objectReference: {fileID: 1184926818} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} m_IsPrefabParent: 0 +--- !u!114 &1184926818 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114935328999071964, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + m_PrefabInternal: {fileID: 1184926817} + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} --- !u!114 &1184926819 stripped MonoBehaviour: m_PrefabParentObject: {fileID: 114999102298893536, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} m_PrefabInternal: {fileID: 1184926817} m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} +--- !u!114 &1184926820 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114646529127711606, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + m_PrefabInternal: {fileID: 1184926817} + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} +--- !u!114 &1184926821 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114821309591766944, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + m_PrefabInternal: {fileID: 1184926817} + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} --- !u!1 &1186065472 GameObject: m_ObjectHideFlags: 0 @@ -3905,6 +4083,112 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 22 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1213473208 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1213473209} + - component: {fileID: 1213473213} + - component: {fileID: 1213473212} + - component: {fileID: 1213473211} + - component: {fileID: 1213473210} + m_Layer: 5 + m_Name: NotificationPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1213473209 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1213473208} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -149.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 658035870} + m_Father: {fileID: 2115786144} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 121} + m_SizeDelta: {x: 700, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1213473210 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1213473208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &1213473211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1213473208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 5 + m_Right: 5 + m_Top: 5 + m_Bottom: 5 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 +--- !u!114 &1213473212 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1213473208} + 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: 0.392} + 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: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1213473213 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1213473208} --- !u!1 &1244254395 GameObject: m_ObjectHideFlags: 0 @@ -4425,7 +4709,7 @@ Prefab: - target: {fileID: 224003334026830312, guid: c67fa24334c0f364cad8798522e92116, type: 2} propertyPath: m_LocalPosition.y - value: 0 + value: 217.19734 objectReference: {fileID: 0} - target: {fileID: 224424466063770242, guid: c67fa24334c0f364cad8798522e92116, type: 2} @@ -5528,6 +5812,112 @@ RenderTexture: m_WrapW: 1 m_Dimension: 2 m_VolumeDepth: 1 +--- !u!1 &1933384739 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1933384740} + - component: {fileID: 1933384744} + - component: {fileID: 1933384743} + - component: {fileID: 1933384742} + - component: {fileID: 1933384741} + m_Layer: 5 + m_Name: MissionPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1933384740 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1933384739} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 528, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2018902400} + m_Father: {fileID: 2115786144} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 130, y: 100} + m_Pivot: {x: 1, y: 0.5} +--- !u!114 &1933384741 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1933384739} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!114 &1933384742 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1933384739} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 5 + m_Right: 5 + m_Top: 5 + m_Bottom: 5 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 1 +--- !u!114 &1933384743 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1933384739} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: a3c9ba309d7999b489463b2ebe102c8b, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 0.303} + 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: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1933384744 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1933384739} --- !u!1 &1946704980 GameObject: m_ObjectHideFlags: 0 @@ -5766,6 +6156,98 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1983515228} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &2018902399 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2018902400} + - component: {fileID: 2018902402} + - component: {fileID: 2018902401} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2018902400 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2018902399} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1056, y: -270.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1933384740} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -991, y: -270.5} + m_SizeDelta: {x: 180, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2018902401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2018902399} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: 'Mission Log : _ + + + Be Spooky at Bookshelf (COMPLETED) + + + Procure the Bookshelf + + + Kill the Duke w/ Bookshelf + + + Eat Bookshelf + + + ???????? + + + Profit' +--- !u!222 &2018902402 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2018902399} --- !u!1 &2105447052 GameObject: m_ObjectHideFlags: 0 @@ -5850,6 +6332,11 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 18 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!224 &2115786144 stripped +RectTransform: + m_PrefabParentObject: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d, + type: 2} + m_PrefabInternal: {fileID: 1184926817} --- !u!1 &2120177222 GameObject: m_ObjectHideFlags: 0 diff --git a/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs b/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs index 27f2ebd..065d283 100644 --- a/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs +++ b/Project Undercover/Assets/Scripts/CharacterStateMachine/Interfaces/Interaction.cs @@ -47,6 +47,6 @@ public class Interaction : ScriptableObject //--------------------------------- Result functions --------------------------------- void SpyMissionComplete(StateController controller) { - ScorePanelController.CompleteMission(); + MissionTracker.Singleton.CompleteMission(this.name); } } diff --git a/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs b/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs index c61a337..b45acb1 100755 --- a/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs +++ b/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs @@ -23,8 +23,6 @@ public class GuardCamera : Photon.PunBehaviour { private float xRotation = 0.0f; private float yRotation = 0.0f; - private string mName; - private List mPlayers; // Photo Player IDs [SerializeField] @@ -37,9 +35,6 @@ public class GuardCamera : Photon.PunBehaviour { mCamera = GetComponent(); mListener = GetComponent(); - // Get the name of this camera. - mName = this.name; - // Everything off by default mSpotlight.enabled = false; mCamera.enabled = false; diff --git a/Project Undercover/Assets/Scripts/Guard/GuardController.cs b/Project Undercover/Assets/Scripts/Guard/GuardController.cs index 473e4b5..b011004 100755 --- a/Project Undercover/Assets/Scripts/Guard/GuardController.cs +++ b/Project Undercover/Assets/Scripts/Guard/GuardController.cs @@ -166,11 +166,11 @@ public class GuardController : Photon.PunBehaviour { { if (hit.transform.gameObject.tag == "NPC") { - ScorePanelController.GuardCaughtNPC(); + MissionTracker.Singleton.CaughtIncorrect(); } else if (hit.transform.gameObject.tag == "Spy") { - ScorePanelController.CaughtSpy(hit.transform.gameObject.GetPhotonView().viewID); + MissionTracker.Singleton.CaughtAgent(hit.transform.gameObject.GetPhotonView().viewID); } } } diff --git a/Project Undercover/Assets/Scripts/Lobby/GameManager.cs b/Project Undercover/Assets/Scripts/Lobby/GameManager.cs index 81f90cb..a3ca2d4 100644 --- a/Project Undercover/Assets/Scripts/Lobby/GameManager.cs +++ b/Project Undercover/Assets/Scripts/Lobby/GameManager.cs @@ -8,7 +8,11 @@ public class GameManager : Photon.PunBehaviour { public GameObject guardController; public GameObject spyPrefab, NPCPrefab, cameraRigPrefab; + + public GameObject missionPanel; + public int numNpcs = 9; + private static GameManager _activeManager = null; public override void OnLeftRoom() @@ -52,7 +56,7 @@ public class GameManager : Photon.PunBehaviour { if (PersistantPlayerSettings.character == PersistantPlayerSettings.Character.Guard) { guardController.SetActive(true); - //guardPanel.SetActive(true); + MissionTracker.IsGuard = true; } else { @@ -61,7 +65,8 @@ public class GameManager : Photon.PunBehaviour { GameObject cameraRig = Instantiate(cameraRigPrefab, Vector3.zero, Quaternion.identity); cameraRig.GetComponentInChildren().SetTarget(spy.transform); - //spyPanel.SetActive(true); + + missionPanel.SetActive(true); } if (PhotonNetwork.isMasterClient) diff --git a/Project Undercover/Assets/Scripts/MissionTracker.cs b/Project Undercover/Assets/Scripts/MissionTracker.cs new file mode 100755 index 0000000..9d2a24f --- /dev/null +++ b/Project Undercover/Assets/Scripts/MissionTracker.cs @@ -0,0 +1,240 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class MissionTracker : Photon.PunBehaviour +{ + const string COMPLETED_TEXT = "(COMPLETED) "; + const string MISSION_LOG_TEXT = "Mission Log: _"; + + const int MAX_GUARD_POINTS = 5; + + const float GUARD_NOTIFICATION_DELAY = 5.0f; + const float GUARD_NOTIFICATION_TIME = 10.0f; + + private static MissionTracker mSingleton; + + public Text spyMissionLogText; + public GameObject guardNotificationPanel; + public Text guardNotificationText; + + private IDictionary mMissionLog; // map interaction to mission + private int mCompletedMissions; + private int mGuardPoints; + private int mGuardIncorrectGuesses; + + private class Mission + { + private string mAlertText; // text shown to overseers after mission completes + private string mDescription; // description of the mission for agents + private string mName; // name of the mission, for dev identification + + public string AlertText { get { return mAlertText; } } + + public bool Completed { get; set; } + + public string Description { get { return mDescription; } } + + public string Name { get { return mName; } } + + public Mission(string name, string description, string alertText) + { + mAlertText = alertText; + mDescription = description; + mName = name; + Completed = false; + } + } + + /** + * The Singleton instance of the MissionTracker. + */ + public static MissionTracker Singleton { get { return mSingleton; } } + + public static bool IsGuard { get; set; } + + /** + * Guard caught a spy. + */ + public void CaughtAgent(int agentId) + { + photonView.RPC("CaughtAgentRPC", PhotonTargets.All, agentId); + } + + /** + * Guard caught a partygoer and must be punished. + */ + public void CaughtIncorrect() + { + photonView.RPC("CaughtIncorrectRPC", PhotonTargets.All); + } + + /** + * Complete a mission, maybe. + */ + public void CompleteMission(string interactionName) + { + // if the interactionName is invalid, cry I guess + if (!mMissionLog.ContainsKey(interactionName)) + { + Debug.Log("Invalid interactionName passed to MissionTracker: " + interactionName); + return; + } + + // grab the mission - if it's already complete, do nothing + Mission m = mMissionLog[interactionName]; + if (m.Completed) + { + return; + } + + // mark it as completed, then update the score and UI + photonView.RPC("CompleteMissionRPC", PhotonTargets.All, interactionName); + } + + /** + * Initialize the MissionTracker with all missions. + */ + void Start() + { + // set the singleton + if (mSingleton) + { + Debug.Log("Multiple MissionTrackers in scene - please limit to one."); + } + mSingleton = this; + + // populate missions and set initial values + mMissionLog = new Dictionary(); + mCompletedMissions = 0; + mGuardPoints = 0; + mGuardIncorrectGuesses = 0; + + mMissionLog["statue_swap"] = new Mission( + "statue_swap", + "Replace the marked statue with a bugged replica.", + "We're picking up some electromagnetic interference. " + + "Enemy forces have planted listening devices somewhere on the premises!" + ); + + mMissionLog["book_message"] = new Mission( + "book_message", + "Plant critical intelligence in the designated book.", + "One of the staff saw someone suspicious over by the bookcases. " + + "The enemy moves among us." + ); + + mMissionLog["bathroom_kill"] = new Mission( + "bathroom_kill", + "Assassinate Knight-Captain Brystol in the bathroom.", + "Our men found Knight-Captain Brystol dead in the bathroom. " + + "The enemy must be stopped!" + ); + + mMissionLog["npc_dance"] = new Mission( + "npc_dance", + "Dance with Duchess Castra to distract her momentarily.", + "The peace talks progress poorly. Duchess Castra keeps getting distracted on the dance floor. " + + "Could this be a strategy of our enemies?" + ); + + mMissionLog["pass_secret"] = new Mission( + "pass_secret", + "Trade intelligence with another spy at the party.", + "One of our staff members spotted two individuals exchanging a secret. " + + "Enemy infiltrators abound." + ); + + mMissionLog["spike_punch"] = new Mission( + "spike_punch", + "Lower the inhibitions of those in attendance by spiking the punch.", + "Several of our guests have become extremely intoxicated. Our catering staff insist " + + "that the punch was non-alcoholic, so we have determined that this must be the plot of " + + "enemy agents." + ); + + UpdateMissionLog(); + StartCoroutine(DisplayNotification("Be on the lookout for enemy agents...")); + + CompleteMission("statue_swap"); + } + + /** + * Update the Mission Log UI element. + */ + private void UpdateMissionLog() + { + string text = MISSION_LOG_TEXT; + foreach (KeyValuePair pair in mMissionLog) + { + text += "\n\n"; + if (pair.Value.Completed) + { + text += COMPLETED_TEXT; + } + text += pair.Value.Description; + } + spyMissionLogText.text = text; + } + + #region coroutines + IEnumerator DisplayNotification(string text) + { + // only display for guards... + if (!IsGuard) + { + yield break; + } + + // wait before displaying notification + yield return new WaitForSeconds(GUARD_NOTIFICATION_DELAY); + + // set the text and show the panel + guardNotificationText.text = text; + guardNotificationPanel.SetActive(true); + + // hide the panel after a certain amount of time + yield return new WaitForSeconds(GUARD_NOTIFICATION_TIME); + guardNotificationPanel.SetActive(false); + + yield return null; + } + #endregion + + #region rpc + [PunRPC] + void CompleteMissionRPC(string interactionName) + { + Mission m = mMissionLog[interactionName]; + m.Completed = true; + mCompletedMissions++; + + float score = mCompletedMissions + mGuardIncorrectGuesses; + ScorePanelController.Singleton.UpdateSpyScore(score / mMissionLog.Count); + + StartCoroutine(DisplayNotification(m.AlertText)); + UpdateMissionLog(); + } + + [PunRPC] + void CaughtAgentRPC(int spyId) + { + mGuardPoints++; + ScorePanelController.Singleton.UpdateGuardScore((float) mGuardPoints / MAX_GUARD_POINTS); + + // Get Random NPC + var npcs = GameManager.ActiveManager.GetNpcs(); + int randInt = (int)(UnityEngine.Random.value * npcs.Count); + GameManager.ActiveManager.photonView.RPC("ReplaceNPCWithSpyRPC", PhotonTargets.All, spyId, npcs[randInt].photonView.viewID); + } + + [PunRPC] + void CaughtIncorrectRPC() + { + mGuardIncorrectGuesses++; + float score = mCompletedMissions + mGuardIncorrectGuesses; + ScorePanelController.Singleton.UpdateSpyScore(score / mMissionLog.Count); + } + #endregion +} diff --git a/Project Undercover/Assets/Scripts/MissionTracker.cs.meta b/Project Undercover/Assets/Scripts/MissionTracker.cs.meta new file mode 100755 index 0000000..a084151 --- /dev/null +++ b/Project Undercover/Assets/Scripts/MissionTracker.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 38ee639fa49fd4048877470b920e67ab +timeCreated: 1511998806 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scripts/UI/ScorePanelController.cs b/Project Undercover/Assets/Scripts/UI/ScorePanelController.cs index 36ad12d..b4fb38e 100644 --- a/Project Undercover/Assets/Scripts/UI/ScorePanelController.cs +++ b/Project Undercover/Assets/Scripts/UI/ScorePanelController.cs @@ -6,49 +6,49 @@ using UnityEngine.UI; public class ScorePanelController : Photon.PunBehaviour { - public Text _timerText; - public Image _guardScore, _spyScore; + public Text timerText; + public Image guardScore, spyScore; - private int _numOfMissions = 5, _maxGuardPoints = 5; - private int _missionsComplete = 0, _numGuardPoints = 0; - private float waitBetweenMissions = 5.0f; - private bool onMissionCooldown = false; + private float initalScoreWidth; + private static ScorePanelController mSingleton; - private float _initalScoreWidth; - private static ScorePanelController ActivePanel; + public static ScorePanelController Singleton { get { return mSingleton; } } - void Start () { - if (!ActivePanel) - ActivePanel = this; - else - Debug.LogError("Two ScorePanelControllers in the scene"); + /** + * Setup the ScorePanelController. + */ + void Start() + { + // set the singleton + if (mSingleton) + { + Debug.LogError("Two ScorePanelControllers in the scene"); + } + mSingleton = this; + + // start the timer update coroutine StartCoroutine(TimerUpdate()); - // Initialize scorebar variables - _initalScoreWidth = _spyScore.rectTransform.sizeDelta.x; - _spyScore.rectTransform.sizeDelta = new Vector2(-1, _spyScore.rectTransform.sizeDelta.y); - _guardScore.rectTransform.sizeDelta = new Vector2(-1, _guardScore.rectTransform.sizeDelta.y); + // initialize scorebar variables + initalScoreWidth = spyScore.rectTransform.sizeDelta.x; + spyScore.rectTransform.sizeDelta = new Vector2(-1, spyScore.rectTransform.sizeDelta.y); + guardScore.rectTransform.sizeDelta = new Vector2(-1, guardScore.rectTransform.sizeDelta.y); } - public static void CompleteMission() + /** + * Update the score panel to reflect a new guard score + */ + public void UpdateGuardScore(float progress) { - if (ActivePanel.onMissionCooldown) - return; - ActivePanel.photonView.RPC("CompleteMissionRPC", PhotonTargets.All); + StartCoroutine(IncreaseScoreBarAnimation(guardScore, progress)); } - public static void CaughtSpy(int spyId) + /** + * Update the score panel to reflect a new spy score + */ + public void UpdateSpyScore(float progress) { - if (ActivePanel.onMissionCooldown) - return; - ActivePanel.photonView.RPC("CaughtSpyRPC", PhotonTargets.All, spyId); - } - - public static void GuardCaughtNPC() - { - if (ActivePanel.onMissionCooldown) - return; - ActivePanel.photonView.RPC("GuardCaughtNPCRPC", PhotonTargets.All); + StartCoroutine(IncreaseScoreBarAnimation(spyScore, progress)); } #region Coroutines @@ -65,7 +65,7 @@ public class ScorePanelController : Photon.PunBehaviour { timeString = minutes.ToString() + ":0" + seconds.ToString(); else timeString = minutes.ToString() + ":" + seconds.ToString(); - _timerText.text = timeString; + timerText.text = timeString; } } @@ -73,7 +73,7 @@ public class ScorePanelController : Photon.PunBehaviour { { Color originalColor = scoreBar.color; var flashCoroutine = StartCoroutine(FlashScoreBar(scoreBar)); - float targetWidth = _initalScoreWidth * progress; + float targetWidth = initalScoreWidth * progress; float overshotWidth = targetWidth * 1.2f; while (true) { @@ -92,10 +92,18 @@ public class ScorePanelController : Photon.PunBehaviour { } StopCoroutine(flashCoroutine); StartCoroutine(ResetScoreBarColor(scoreBar, originalColor)); - if (_numGuardPoints >= _maxGuardPoints) - photonView.RPC("ShowWinScreen", PhotonTargets.All, true); - else if (_missionsComplete >= _numOfMissions) - photonView.RPC("ShowWinScreen", PhotonTargets.All, false); + + if (progress >= 1.0) + { + if (scoreBar == guardScore) + { + photonView.RPC("ShowWinScreen", PhotonTargets.All, true); + } + else + { + photonView.RPC("ShowWinScreen", PhotonTargets.All, false); + } + } yield return null; } @@ -151,48 +159,9 @@ public class ScorePanelController : Photon.PunBehaviour { } yield return null; } - - IEnumerator MissionCooldown() - { - onMissionCooldown = true; - yield return new WaitForSeconds(waitBetweenMissions); - onMissionCooldown = false; - } #endregion #region PunRPC - [PunRPC] - void CompleteMissionRPC() - { - Debug.Log("Mission Completed!"); - _missionsComplete++; - StartCoroutine(MissionCooldown()); - StartCoroutine(IncreaseScoreBarAnimation(_spyScore, (float)_missionsComplete / _numOfMissions)); - } - - [PunRPC] - void CaughtSpyRPC(int spyId) - { - Debug.Log("Spy Caught!"); - _numGuardPoints++; - StartCoroutine(MissionCooldown()); - StartCoroutine(IncreaseScoreBarAnimation(_guardScore, (float)_numGuardPoints / _maxGuardPoints)); - - // Get Random NPC - var npcs = GameManager.ActiveManager.GetNpcs(); - int randInt = (int)(UnityEngine.Random.value * npcs.Count); - GameManager.ActiveManager.photonView.RPC("ReplaceNPCWithSpyRPC", PhotonTargets.All, spyId, npcs[randInt].photonView.viewID); - } - - [PunRPC] - void GuardCaughtNPCRPC() - { - Debug.Log("Guard caught an NPC! Giving points to spies!"); - _missionsComplete++; - StartCoroutine(MissionCooldown()); - StartCoroutine(IncreaseScoreBarAnimation(_spyScore, (float)_missionsComplete / _numOfMissions)); - } - [PunRPC] void ShowWinScreen(bool guardsOrSpies) {