From 041e4d4e08e6be711dd8fc2a73647952610bcc31 Mon Sep 17 00:00:00 2001 From: Randall Dolifka Date: Sun, 5 Nov 2017 22:02:03 -0600 Subject: [PATCH 1/2] Added preview mode for guard cameras - now they can be viewed all at once. Needs UI changes to make this more usable. --- Project Undercover/Assets/Scenes/TEST.unity | 186 ++++++++++++++++-- .../Assets/Scripts/Guard/GuardCamera.cs | 31 +++ .../Assets/Scripts/Guard/GuardController.cs | 124 +++++++++--- 3 files changed, 298 insertions(+), 43 deletions(-) mode change 100644 => 100755 Project Undercover/Assets/Scenes/TEST.unity diff --git a/Project Undercover/Assets/Scenes/TEST.unity b/Project Undercover/Assets/Scenes/TEST.unity old mode 100644 new mode 100755 index b97f190..a601636 --- a/Project Undercover/Assets/Scenes/TEST.unity +++ b/Project Undercover/Assets/Scenes/TEST.unity @@ -77,15 +77,17 @@ LightmapSettings: m_PVRDirectSampleCount: 32 m_PVRSampleCount: 500 m_PVRBounces: 2 - m_PVRFiltering: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 m_PVRFilteringMode: 1 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousColorSigma: 1 - m_PVRFilteringAtrousNormalSigma: 1 - m_PVRFilteringAtrousPositionSigma: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 m_LightingDataAsset: {fileID: 0} m_UseShadowmask: 1 --- !u!196 &4 @@ -107,6 +109,8 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 + debug: + m_Flags: 0 m_NavMeshData: {fileID: 23800000, guid: 14079ed931b555c4abfc3a6895d12632, type: 2} --- !u!1 &40329368 GameObject: @@ -163,6 +167,86 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 15 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &61897354 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 61897358} + - component: {fileID: 61897357} + - component: {fileID: 61897356} + - component: {fileID: 61897355} + m_Layer: 0 + m_Name: Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &61897355 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61897354} + m_Enabled: 1 +--- !u!124 &61897356 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61897354} + m_Enabled: 1 +--- !u!20 &61897357 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61897354} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -2 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &61897358 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61897354} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5.461338, y: 8.988628, z: 6.0364428} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &81075120 GameObject: m_ObjectHideFlags: 0 @@ -203,6 +287,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -218,6 +303,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -272,6 +358,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -287,6 +374,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -367,6 +455,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -382,6 +471,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -449,6 +539,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -464,6 +555,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -516,7 +608,7 @@ RectTransform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 164040928} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 478, y: -245.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 854709136} @@ -623,6 +715,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -638,6 +731,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -892,6 +986,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -907,6 +1002,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1006,6 +1102,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1021,6 +1118,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1088,6 +1186,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1103,6 +1202,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1279,6 +1379,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1294,6 +1395,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1362,6 +1464,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1377,6 +1480,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1444,6 +1548,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1459,6 +1564,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1579,6 +1685,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1594,6 +1701,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1632,7 +1740,7 @@ Transform: m_LocalScale: {x: 2, y: 3, z: 0.5} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &678649002 GameObject: @@ -1661,6 +1769,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1676,6 +1785,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1716,7 +1826,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 3} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: -20} --- !u!1 &710257908 GameObject: @@ -1758,6 +1868,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1773,6 +1884,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -1946,6 +2058,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1961,6 +2074,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2029,6 +2143,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2044,6 +2159,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2111,6 +2227,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2126,6 +2243,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2193,6 +2311,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2208,6 +2327,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2275,6 +2395,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2290,6 +2411,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2431,6 +2553,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2446,6 +2569,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2565,6 +2689,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2580,6 +2705,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2618,7 +2744,7 @@ Transform: m_LocalScale: {x: 1.5, y: 1, z: 3} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &948654262 GameObject: @@ -2661,6 +2787,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2676,6 +2803,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -2808,6 +2936,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -2823,6 +2952,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3017,12 +3147,12 @@ Prefab: - target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} propertyPath: m_LocalPosition.x - value: 0 + value: 528 objectReference: {fileID: 0} - target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} propertyPath: m_LocalPosition.y - value: 0 + value: 270.5 objectReference: {fileID: 0} - target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} @@ -3052,7 +3182,7 @@ Prefab: - target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} propertyPath: m_RootOrder - value: 12 + value: 13 objectReference: {fileID: 0} - target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d, type: 2} @@ -3305,6 +3435,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3320,6 +3451,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3429,6 +3561,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3444,6 +3577,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3498,6 +3632,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3513,6 +3648,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3593,6 +3729,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3608,6 +3745,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3681,6 +3819,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3696,6 +3835,7 @@ MeshRenderer: m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3723,7 +3863,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1391762869 Prefab: @@ -3821,6 +3961,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3836,6 +3977,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -3916,6 +4058,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -3931,6 +4074,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4050,6 +4194,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4065,6 +4210,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4103,7 +4249,7 @@ Transform: m_LocalScale: {x: 5, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1622088805 GameObject: @@ -4146,6 +4292,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4161,6 +4308,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4267,6 +4415,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4282,6 +4431,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4349,6 +4499,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4364,6 +4515,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4431,6 +4583,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4446,6 +4599,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4513,6 +4667,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4528,6 +4683,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4722,6 +4878,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4737,6 +4894,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 @@ -4791,6 +4949,7 @@ MeshRenderer: m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 + m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -4806,6 +4965,7 @@ MeshRenderer: m_PreserveUVs: 1 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 + m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 diff --git a/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs b/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs index 2ed7de5..fd1db70 100755 --- a/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs +++ b/Project Undercover/Assets/Scripts/Guard/GuardCamera.cs @@ -10,6 +10,8 @@ public class GuardCamera : Photon.PunBehaviour { private float xRotation = 0.0f; private float yRotation = 0.0f; + private string mName; + private List mPlayers; // Photo Player IDs void Start() @@ -19,6 +21,9 @@ 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; @@ -65,6 +70,32 @@ public class GuardCamera : Photon.PunBehaviour { photonView.RPC("RemovePlayer", PhotonTargets.All, PhotonNetwork.player.ID); } + /** + * Disable preview mode. See EnablePreviewMode(). + */ + public void DisablePreviewMode() + { + // Turn off the camera. + mCamera.enabled = false; + + // Reset the viewport to original dimensions. + mCamera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); + } + + /** + * Enable preview mode, which allows cameras to be viewed side-by-side + * like a guard screen. + */ + public void EnablePreviewMode(float size, int x, int y) + { + // Turn on the camera in case it was disabled, but disable sound. + mCamera.enabled = true; + mListener.enabled = false; + + // Set the viewport appropriately. + mCamera.rect = new Rect(size * x, size * y, size, size); + } + public bool InControl() { if (mPlayers.Count == 0 || mPlayers[0] != PhotonNetwork.player.ID) diff --git a/Project Undercover/Assets/Scripts/Guard/GuardController.cs b/Project Undercover/Assets/Scripts/Guard/GuardController.cs index 8a4b4c6..bc2302e 100755 --- a/Project Undercover/Assets/Scripts/Guard/GuardController.cs +++ b/Project Undercover/Assets/Scripts/Guard/GuardController.cs @@ -8,7 +8,7 @@ public class GuardController : Photon.PunBehaviour { const float CAMERA_SENSITIVITY = 120.0f; - private int mCurrentCamera; + private int mCurrentCamera; // -1 means preview mode private List mCameras; private bool mInControl; @@ -26,10 +26,47 @@ public class GuardController : Photon.PunBehaviour { } } - // Default is no camera. First to get it in Update wins. - // Photon doesn't seem to sync camera players until update, - // so if we Activate() here, it won't lock. + // Default is preview mode. mCurrentCamera = -1; + EnablePreviewMode(); + } + + /** + * Disable preview mode on all cameras. + */ + void DisablePreviewMode() + { + if (mCurrentCamera >= 0) + { + return; + } + foreach (var guardCamera in mCameras) + { + guardCamera.DisablePreviewMode(); + } + } + + /** + * Enable preview mode on call cameras and position them appropriately. + */ + void EnablePreviewMode() + { + // Deactivate current camera, if necessary. + if (mCurrentCamera != -1) + { + mCameras[mCurrentCamera].Deactivate(); + } + mCurrentCamera = -1; + + // Cameras are always arranged in ZxZ rows and columns. Determine Z. + int z = (int) Mathf.Ceil(Mathf.Sqrt(mCameras.Count)); + float size = 1.0f / z; + + // Set all cameras to preview mode appropriately. + for (int i = 0; i < mCameras.Count; ++i) + { + mCameras[i].EnablePreviewMode(size, i % z, i / z); + } } /** @@ -37,6 +74,7 @@ public class GuardController : Photon.PunBehaviour { */ void SetCameraText() { + // TODO - GuardCamera should be responsible for text. if (mInControl) { cameraStatusText.text = "In-Control"; @@ -48,14 +86,13 @@ public class GuardController : Photon.PunBehaviour { } /** - * Cycle the player to the next camera, or grab the first camera - * if we don't have one yet. + * Cycle the player to a specific camera, or just the next one. */ - void SwitchCamera() + void SwitchCamera(int nextCamera = -1) { // Get relevant camera indexes int lastCamera = mCurrentCamera; - mCurrentCamera += 1; + mCurrentCamera = nextCamera == -1 ? mCurrentCamera + 1 : nextCamera; if (mCurrentCamera >= mCameras.Count) { mCurrentCamera = 0; @@ -75,7 +112,54 @@ public class GuardController : Photon.PunBehaviour { void Update() { - if (Input.GetKeyDown("space") || mCurrentCamera == -1) + if (mCurrentCamera < 0) + { + UpdatePreviewMode(); + } + else + { + UpdateSingle(); + } + } + + void UpdatePreviewMode() + { + // If the player clicks a camera, switch to that camera. + if (Input.GetButtonDown("Fire1")) + { + // Get the click location. + float x = Input.mousePosition.x / Screen.width; + float y = Input.mousePosition.y / Screen.height; + + // Cameras are always arranged in ZxZ rows and columns. Determine Z. + int z = (int)Mathf.Ceil(Mathf.Sqrt(mCameras.Count)); + float size = 1.0f / z; + + // Determine the camera that the click corresponds to, if any. + int tileX = (int) (x / size); + int tileY = (int) (y / size); + int camera = tileY * z + tileX; + + // If the camera is valid, switch to it. + if (camera < mCameras.Count) + { + DisablePreviewMode(); + SwitchCamera(camera); + } + } + } + + void UpdateSingle() + { + // Escape switches to Preview Mode. + if (Input.GetKeyDown("escape")) + { + EnablePreviewMode(); + return; + } + + // Space switches to next camera. + if (Input.GetKeyDown("space")) { SwitchCamera(); } @@ -88,26 +172,6 @@ public class GuardController : Photon.PunBehaviour { SetCameraText(); } - /*RaycastHit hit; - if (Input.GetButtonDown("Fire1")) - { - Ray ray = GetComponent().ScreenPointToRay(Input.mousePosition); - - if (Physics.Raycast(ray, out hit, 100.0f)) - { - if (hit.transform.gameObject.tag == "NPC") - { - var manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent(); - manager.photonView.RPC("ShowSpiesWinScreen", PhotonTargets.All); - } - else if (hit.transform.gameObject.tag == "Spy") - { - var manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent(); - manager.photonView.RPC("ShowGuardsWinScreen", PhotonTargets.All); - } - } - }*/ - if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0) { return; @@ -116,5 +180,5 @@ public class GuardController : Photon.PunBehaviour { float xRotation = Time.deltaTime * Input.GetAxis("Horizontal") * CAMERA_SENSITIVITY; float yRotation = Time.deltaTime * -Input.GetAxis("Vertical") * CAMERA_SENSITIVITY; mCameras[mCurrentCamera].Rotate(xRotation, yRotation); - } + } } \ No newline at end of file From fc1fdcd89c34e5b2caa230ebea732cf1850527c2 Mon Sep 17 00:00:00 2001 From: Randall Dolifka Date: Sun, 5 Nov 2017 22:07:06 -0600 Subject: [PATCH 2/2] Added more notes for future work. --- Project Undercover/Assets/Scripts/Guard/GuardController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Project Undercover/Assets/Scripts/Guard/GuardController.cs b/Project Undercover/Assets/Scripts/Guard/GuardController.cs index bc2302e..23d47f8 100755 --- a/Project Undercover/Assets/Scripts/Guard/GuardController.cs +++ b/Project Undercover/Assets/Scripts/Guard/GuardController.cs @@ -75,6 +75,8 @@ public class GuardController : Photon.PunBehaviour { void SetCameraText() { // TODO - GuardCamera should be responsible for text. + // Each GuardCamera should display its name in colored text. + // Red denotes that it is owned by another player, Green denotes free. if (mInControl) { cameraStatusText.text = "In-Control";