Merge pull request #37 from jrdoli/feature/guard-cameras
Guard Cameras (Issue #26)
This commit is contained in:
commit
2fedeebcfe
19 changed files with 715 additions and 185 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@
|
||||||
**/Assets/AssetStoreTools*
|
**/Assets/AssetStoreTools*
|
||||||
|
|
||||||
# Autogenerated VS/MD solution and project files
|
# Autogenerated VS/MD solution and project files
|
||||||
|
**/.vs/
|
||||||
**/ExportedObj/
|
**/ExportedObj/
|
||||||
**/*.csproj
|
**/*.csproj
|
||||||
#*.unityproj
|
#*.unityproj
|
||||||
|
|
Binary file not shown.
Binary file not shown.
78
Project Undercover/Assets/Resources/Guard Camera.prefab
Normal file → Executable file
78
Project Undercover/Assets/Resources/Guard Camera.prefab
Normal file → Executable file
|
@ -19,13 +19,13 @@ GameObject:
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4661043116803332}
|
- component: {fileID: 4661043116803332}
|
||||||
- component: {fileID: 114306799516802978}
|
|
||||||
- component: {fileID: 20437103875467350}
|
- component: {fileID: 20437103875467350}
|
||||||
- component: {fileID: 124909405360866564}
|
- component: {fileID: 124909405360866564}
|
||||||
- component: {fileID: 92524413853108834}
|
- component: {fileID: 92524413853108834}
|
||||||
- component: {fileID: 81070402336043930}
|
- component: {fileID: 81070402336043930}
|
||||||
- component: {fileID: 114560588529924034}
|
- component: {fileID: 114214698486704570}
|
||||||
- component: {fileID: 114324944445225698}
|
- component: {fileID: 114503650767683602}
|
||||||
|
- component: {fileID: 108724348204580334}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Guard Camera
|
m_Name: Guard Camera
|
||||||
m_TagString: GuardCamera
|
m_TagString: GuardCamera
|
||||||
|
@ -179,18 +179,68 @@ Behaviour:
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
m_GameObject: {fileID: 1889434021946074}
|
m_GameObject: {fileID: 1889434021946074}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
--- !u!114 &114306799516802978
|
--- !u!108 &108724348204580334
|
||||||
MonoBehaviour:
|
Light:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
m_GameObject: {fileID: 1889434021946074}
|
m_GameObject: {fileID: 1889434021946074}
|
||||||
m_Enabled: 0
|
m_Enabled: 0
|
||||||
|
serializedVersion: 8
|
||||||
|
m_Type: 0
|
||||||
|
m_Color: {r: 1, g: 0, b: 0, a: 1}
|
||||||
|
m_Intensity: 3
|
||||||
|
m_Range: 10
|
||||||
|
m_SpotAngle: 48.2
|
||||||
|
m_CookieSize: 10
|
||||||
|
m_Shadows:
|
||||||
|
m_Type: 2
|
||||||
|
m_Resolution: -1
|
||||||
|
m_CustomResolution: -1
|
||||||
|
m_Strength: 1
|
||||||
|
m_Bias: 0.05
|
||||||
|
m_NormalBias: 0.4
|
||||||
|
m_NearPlane: 0.2
|
||||||
|
m_Cookie: {fileID: 0}
|
||||||
|
m_DrawHalo: 0
|
||||||
|
m_Flare: {fileID: 0}
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_Lightmapping: 4
|
||||||
|
m_AreaSize: {x: 1, y: 1}
|
||||||
|
m_BounceIntensity: 1
|
||||||
|
m_FalloffTable:
|
||||||
|
m_Table[0]: 0
|
||||||
|
m_Table[1]: 0
|
||||||
|
m_Table[2]: 0
|
||||||
|
m_Table[3]: 0
|
||||||
|
m_Table[4]: 0
|
||||||
|
m_Table[5]: 0
|
||||||
|
m_Table[6]: 0
|
||||||
|
m_Table[7]: 0
|
||||||
|
m_Table[8]: 0
|
||||||
|
m_Table[9]: 0
|
||||||
|
m_Table[10]: 0
|
||||||
|
m_Table[11]: 0
|
||||||
|
m_Table[12]: 0
|
||||||
|
m_ColorTemperature: 6570
|
||||||
|
m_UseColorTemperature: 0
|
||||||
|
m_ShadowRadius: 0
|
||||||
|
m_ShadowAngle: 0
|
||||||
|
--- !u!114 &114214698486704570
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1889434021946074}
|
||||||
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 1ef9de564c5529c4faeace3894ec9e0b, type: 3}
|
m_Script: {fileID: 11500000, guid: 5b4e3fd11940c1048a7e28e5dfc80560, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!114 &114324944445225698
|
--- !u!114 &114503650767683602
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
@ -216,20 +266,6 @@ MonoBehaviour:
|
||||||
instantiationId: -1
|
instantiationId: -1
|
||||||
currentMasterID: -1
|
currentMasterID: -1
|
||||||
isRuntimeInstantiated: 0
|
isRuntimeInstantiated: 0
|
||||||
--- !u!114 &114560588529924034
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
|
||||||
m_GameObject: {fileID: 1889434021946074}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 5b4e3fd11940c1048a7e28e5dfc80560, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
xRotation: 0
|
|
||||||
yRotation: 0
|
|
||||||
laserSightEnabled: 0
|
|
||||||
--- !u!124 &124909405360866564
|
--- !u!124 &124909405360866564
|
||||||
Behaviour:
|
Behaviour:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
|
|
2
Project Undercover/Assets/Resources/PhotonServerSettings.asset
Normal file → Executable file
2
Project Undercover/Assets/Resources/PhotonServerSettings.asset
Normal file → Executable file
|
@ -69,4 +69,6 @@ MonoBehaviour:
|
||||||
- SetCharacterColorRPC
|
- SetCharacterColorRPC
|
||||||
- ShowWinScreen
|
- ShowWinScreen
|
||||||
- CaughtSpy
|
- CaughtSpy
|
||||||
|
- AddPlayer
|
||||||
|
- RemovePlayer
|
||||||
DisableAutoOpenWizard: 1
|
DisableAutoOpenWizard: 1
|
||||||
|
|
385
Project Undercover/Assets/Scenes/NewCharactersTest.unity
Normal file → Executable file
385
Project Undercover/Assets/Scenes/NewCharactersTest.unity
Normal file → Executable file
|
@ -108,6 +108,80 @@ NavMeshSettings:
|
||||||
tileSize: 256
|
tileSize: 256
|
||||||
accuratePlacement: 0
|
accuratePlacement: 0
|
||||||
m_NavMeshData: {fileID: 23800000, guid: 1a93cbd9ec4baca409ccdb8d4a51d035, type: 2}
|
m_NavMeshData: {fileID: 23800000, guid: 1a93cbd9ec4baca409ccdb8d4a51d035, type: 2}
|
||||||
|
--- !u!1 &429059608
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
serializedVersion: 5
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 429059609}
|
||||||
|
- component: {fileID: 429059611}
|
||||||
|
- component: {fileID: 429059610}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: CameraStatusText
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &429059609
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 429059608}
|
||||||
|
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: 872119432}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 50, y: -25}
|
||||||
|
m_SizeDelta: {x: 100, y: 50}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &429059610
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 429059608}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, 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: 4
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text:
|
||||||
|
--- !u!222 &429059611
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 429059608}
|
||||||
--- !u!1001 &786039778
|
--- !u!1001 &786039778
|
||||||
Prefab:
|
Prefab:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -153,7 +227,7 @@ Prefab:
|
||||||
- target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d,
|
- target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d,
|
||||||
type: 2}
|
type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 2
|
value: 5
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d,
|
- target: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -273,6 +347,231 @@ MonoBehaviour:
|
||||||
type: 2}
|
type: 2}
|
||||||
m_PrefabInternal: {fileID: 786039778}
|
m_PrefabInternal: {fileID: 786039778}
|
||||||
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||||
|
--- !u!224 &786039780 stripped
|
||||||
|
RectTransform:
|
||||||
|
m_PrefabParentObject: {fileID: 224257512679546302, guid: 2e0806d99e91f374fb64a63401c2eb5d,
|
||||||
|
type: 2}
|
||||||
|
m_PrefabInternal: {fileID: 786039778}
|
||||||
|
--- !u!1 &872119431
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
serializedVersion: 5
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 872119432}
|
||||||
|
- component: {fileID: 872119435}
|
||||||
|
- component: {fileID: 872119434}
|
||||||
|
- component: {fileID: 872119433}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: CameraStatusPanel
|
||||||
|
m_TagString: GuardPanel
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
|
--- !u!224 &872119432
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 872119431}
|
||||||
|
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: 429059609}
|
||||||
|
m_Father: {fileID: 786039780}
|
||||||
|
m_RootOrder: 4
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 1, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 0}
|
||||||
|
m_AnchoredPosition: {x: -50, y: 25}
|
||||||
|
m_SizeDelta: {x: 100, y: 50}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &872119433
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 872119431}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Padding:
|
||||||
|
m_Left: 0
|
||||||
|
m_Right: 0
|
||||||
|
m_Top: 0
|
||||||
|
m_Bottom: 0
|
||||||
|
m_ChildAlignment: 0
|
||||||
|
m_Spacing: 0
|
||||||
|
m_ChildForceExpandWidth: 1
|
||||||
|
m_ChildForceExpandHeight: 1
|
||||||
|
m_ChildControlWidth: 1
|
||||||
|
m_ChildControlHeight: 1
|
||||||
|
--- !u!114 &872119434
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 872119431}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, 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 &872119435
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 872119431}
|
||||||
|
--- !u!1001 &974281857
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 10
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 10
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0.099609084
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: -0.89890945
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0.27325925
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 0.3276725
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1889434021946074, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Guard Camera 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114503650767683602, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: viewIdField
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114503650767683602, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: instantiationId
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 33.817
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: -139.944
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
m_IsPrefabParent: 0
|
||||||
|
--- !u!1001 &1014909179
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: -10
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: -10
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0.25073984
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0.44904676
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: -0.13289404
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 0.84724593
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1889434021946074, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Guard Camera 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114503650767683602, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: viewIdField
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114503650767683602, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: instantiationId
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 32.972
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 55.848003
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
m_IsPrefabParent: 0
|
||||||
--- !u!1 &1130873136
|
--- !u!1 &1130873136
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -398,7 +697,7 @@ Transform:
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 6
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1303335403
|
--- !u!1 &1303335403
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -427,7 +726,7 @@ Transform:
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 7
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &1303335405
|
--- !u!114 &1303335405
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
@ -440,18 +739,62 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: d137f9629e081d64a81c3c6139493989, type: 3}
|
m_Script: {fileID: 11500000, guid: d137f9629e081d64a81c3c6139493989, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
guardCamera: {fileID: 1654923637}
|
guardController: {fileID: 1686843191}
|
||||||
spyPrefab: {fileID: 1736268233368836, guid: 8de347aada1dce74ca095e2694bfa639, type: 2}
|
spyPrefab: {fileID: 1736268233368836, guid: 8de347aada1dce74ca095e2694bfa639, type: 2}
|
||||||
NPCPrefab: {fileID: 1249949894527080, guid: ea4aade53c5c4714b8b9c335e8100cf0, type: 2}
|
NPCPrefab: {fileID: 1249949894527080, guid: ea4aade53c5c4714b8b9c335e8100cf0, type: 2}
|
||||||
cameraRigPrefab: {fileID: 1009033979625728, guid: 1764211b5690c164d82aa46fa4ec707d,
|
cameraRigPrefab: {fileID: 1009033979625728, guid: 1764211b5690c164d82aa46fa4ec707d,
|
||||||
type: 2}
|
type: 2}
|
||||||
numNpcs: 10
|
numNpcs: 10
|
||||||
--- !u!114 &1654923637 stripped
|
spyMissionsComplete: 0
|
||||||
|
waitBetweenMissions: 5
|
||||||
|
onMissionCooldown: 0
|
||||||
|
missionsCompleteText: {fileID: 0}
|
||||||
|
winPanel: {fileID: 0}
|
||||||
|
guardPanel: {fileID: 0}
|
||||||
|
spyPanel: {fileID: 0}
|
||||||
|
guardCameraPanel: {fileID: 872119431}
|
||||||
|
winText: {fileID: 0}
|
||||||
|
--- !u!1 &1686843191
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
serializedVersion: 5
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1686843193}
|
||||||
|
- component: {fileID: 1686843192}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: GuardController
|
||||||
|
m_TagString: GuardCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
|
--- !u!114 &1686843192
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_PrefabParentObject: {fileID: 114306799516802978, guid: c67fa24334c0f364cad8798522e92116,
|
m_ObjectHideFlags: 0
|
||||||
type: 2}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 2060245567}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_Script: {fileID: 11500000, guid: 1ef9de564c5529c4faeace3894ec9e0b, type: 3}
|
m_GameObject: {fileID: 1686843191}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 828c2a73d6549534cb33b938c6964162, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
cameraStatusText: {fileID: 429059610}
|
||||||
|
--- !u!4 &1686843193
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1686843191}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -7.593328, y: 6.564911, z: 10.370603}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 9
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1756076058
|
--- !u!1 &1756076058
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -515,7 +858,7 @@ Transform:
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 8
|
||||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||||
--- !u!1001 &2060245567
|
--- !u!1001 &2060245567
|
||||||
Prefab:
|
Prefab:
|
||||||
|
@ -554,17 +897,17 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 5
|
value: 3
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114324944445225698, guid: c67fa24334c0f364cad8798522e92116,
|
- target: {fileID: 114324944445225698, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
type: 2}
|
type: 2}
|
||||||
propertyPath: viewIdField
|
propertyPath: viewIdField
|
||||||
value: 3
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114324944445225698, guid: c67fa24334c0f364cad8798522e92116,
|
- target: {fileID: 114324944445225698, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
type: 2}
|
type: 2}
|
||||||
propertyPath: instantiationId
|
propertyPath: instantiationId
|
||||||
value: 3
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114560588529924034, guid: c67fa24334c0f364cad8798522e92116,
|
- target: {fileID: 114560588529924034, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -581,6 +924,20 @@ Prefab:
|
||||||
propertyPath: m_Enabled
|
propertyPath: m_Enabled
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114503650767683602, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: viewIdField
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114503650767683602, guid: c67fa24334c0f364cad8798522e92116,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: instantiationId
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1889434021946074, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Guard Camera 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2}
|
||||||
m_IsPrefabParent: 0
|
m_IsPrefabParent: 0
|
||||||
|
@ -705,5 +1062,5 @@ Transform:
|
||||||
m_LocalScale: {x: 20, y: 0.1, z: 20}
|
m_LocalScale: {x: 20, y: 0.1, z: 20}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
177
Project Undercover/Assets/Scripts/Guard/GuardCamera.cs
Normal file → Executable file
177
Project Undercover/Assets/Scripts/Guard/GuardCamera.cs
Normal file → Executable file
|
@ -1,39 +1,138 @@
|
||||||
using System.Collections;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using UnityEngine;
|
||||||
using UnityEngine;
|
|
||||||
|
public class GuardCamera : Photon.PunBehaviour {
|
||||||
public class GuardCamera : Photon.PunBehaviour {
|
|
||||||
|
private Light mSpotlight;
|
||||||
public float xRotation = 0.0f;
|
private Camera mCamera;
|
||||||
public float yRotation = 0.0f;
|
private AudioListener mListener;
|
||||||
public Light spotLight;
|
|
||||||
|
private float xRotation = 0.0f;
|
||||||
void Start () {
|
private float yRotation = 0.0f;
|
||||||
xRotation = transform.eulerAngles.y;
|
|
||||||
yRotation = transform.eulerAngles.x;
|
private List<int> mPlayers; // Photo Player IDs
|
||||||
}
|
|
||||||
|
void Start()
|
||||||
void Update () {
|
{
|
||||||
Quaternion newRotation = Quaternion.AngleAxis(xRotation, Vector3.up);
|
// Get components
|
||||||
newRotation *= Quaternion.AngleAxis(-yRotation, -Vector3.right);
|
mSpotlight = GetComponent<Light>();
|
||||||
transform.localRotation = Quaternion.Slerp(transform.rotation, newRotation, Time.time * 0.01f);
|
mCamera = GetComponent<Camera>();
|
||||||
}
|
mListener = GetComponent<AudioListener>();
|
||||||
|
|
||||||
public void UpdateRotation()
|
// Everything off by default
|
||||||
{
|
mSpotlight.enabled = false;
|
||||||
photonView.RPC("UpdateRotation", PhotonTargets.All, xRotation, yRotation);
|
mCamera.enabled = false;
|
||||||
}
|
mListener.enabled = false;
|
||||||
|
|
||||||
[PunRPC]
|
// Initalize rotation information
|
||||||
void UpdateRotation(float xRotation, float yRotation)
|
xRotation = transform.eulerAngles.y;
|
||||||
{
|
yRotation = transform.eulerAngles.x;
|
||||||
this.xRotation = xRotation;
|
|
||||||
this.yRotation = yRotation;
|
// Initialize empty player queue
|
||||||
}
|
mPlayers = new List<int>();
|
||||||
|
}
|
||||||
[PunRPC]
|
|
||||||
void SetEnabledRPC(bool enabled)
|
void Update()
|
||||||
{
|
{
|
||||||
spotLight.enabled = enabled;
|
Quaternion newRotation = Quaternion.AngleAxis(xRotation, Vector3.up);
|
||||||
}
|
newRotation *= Quaternion.AngleAxis(-yRotation, -Vector3.right);
|
||||||
}
|
transform.localRotation = Quaternion.Slerp(transform.rotation, newRotation, Time.time * 0.01f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the player switches to a camera.
|
||||||
|
*/
|
||||||
|
public void Activate()
|
||||||
|
{
|
||||||
|
// Turn on this camera for the player.
|
||||||
|
mCamera.enabled = true;
|
||||||
|
mListener.enabled = true;
|
||||||
|
|
||||||
|
// Trigger adding a player to this camera.
|
||||||
|
photonView.RPC("AddPlayer", PhotonTargets.All, PhotonNetwork.player.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player switches away from a camera.
|
||||||
|
*/
|
||||||
|
public void Deactivate()
|
||||||
|
{
|
||||||
|
// Turn off this camera for the player.
|
||||||
|
mCamera.enabled = false;
|
||||||
|
mListener.enabled = false;
|
||||||
|
|
||||||
|
// Trigger removing a player from this camera.
|
||||||
|
photonView.RPC("RemovePlayer", PhotonTargets.All, PhotonNetwork.player.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool InControl()
|
||||||
|
{
|
||||||
|
if (mPlayers.Count == 0 || mPlayers[0] != PhotonNetwork.player.ID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to rotate the camera.
|
||||||
|
*/
|
||||||
|
public void Rotate(float xRotation, float yRotation)
|
||||||
|
{
|
||||||
|
// Do nothing if not in control.
|
||||||
|
if (!InControl())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the new rotation.
|
||||||
|
this.xRotation += xRotation;
|
||||||
|
this.yRotation += yRotation;
|
||||||
|
|
||||||
|
// Limit the rotation according to these constraints.
|
||||||
|
this.xRotation = this.xRotation % 360;
|
||||||
|
this.yRotation = Mathf.Clamp(this.yRotation, -45, 80);
|
||||||
|
|
||||||
|
// Notify everyone else that the camera rotated.
|
||||||
|
photonView.RPC("UpdateRotation", PhotonTargets.Others, this.xRotation, this.yRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called via RPC to add a player to this camera.
|
||||||
|
*/
|
||||||
|
[PunRPC]
|
||||||
|
void AddPlayer(int player)
|
||||||
|
{
|
||||||
|
// Add the player to the queue.
|
||||||
|
mPlayers.Add(player);
|
||||||
|
|
||||||
|
// Because there is now a player, make sure the spotlight is on.
|
||||||
|
mSpotlight.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called via RPC to remove a player from this camera.
|
||||||
|
*/
|
||||||
|
[PunRPC]
|
||||||
|
void RemovePlayer(int player)
|
||||||
|
{
|
||||||
|
// Remove the player from the queue.
|
||||||
|
mPlayers.Remove(player);
|
||||||
|
|
||||||
|
// If no more players, turn off spotlight.
|
||||||
|
if (mPlayers.Count == 0)
|
||||||
|
{
|
||||||
|
mSpotlight.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called via RPC to update with new rotation data.
|
||||||
|
*/
|
||||||
|
[PunRPC]
|
||||||
|
void UpdateRotation(float xRotation, float yRotation)
|
||||||
|
{
|
||||||
|
this.xRotation = xRotation;
|
||||||
|
this.yRotation = yRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
2
Project Undercover/Assets/Scripts/Guard/GuardCamera.cs.meta
Normal file → Executable file
2
Project Undercover/Assets/Scripts/Guard/GuardCamera.cs.meta
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5b4e3fd11940c1048a7e28e5dfc80560
|
guid: 5b4e3fd11940c1048a7e28e5dfc80560
|
||||||
timeCreated: 1505971935
|
timeCreated: 1508202966
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class GuardCameraController : Photon.PunBehaviour {
|
|
||||||
|
|
||||||
private float camSens = 120.0f;
|
|
||||||
private GuardCamera cam;
|
|
||||||
|
|
||||||
static List<GuardCameraController> cameras;
|
|
||||||
static int currentCamera;
|
|
||||||
|
|
||||||
void Start () {
|
|
||||||
cam = GetComponent<GuardCamera>();
|
|
||||||
if (cameras == null)
|
|
||||||
{
|
|
||||||
cameras = new List<GuardCameraController>();
|
|
||||||
foreach (var camera in GameObject.FindGameObjectsWithTag(tag))
|
|
||||||
{
|
|
||||||
cameras.Add(camera.GetComponent<GuardCameraController>());
|
|
||||||
}
|
|
||||||
for (int i=0; i < cameras.Count; i++)
|
|
||||||
{
|
|
||||||
if (cameras[i] == this)
|
|
||||||
currentCamera = i;
|
|
||||||
else
|
|
||||||
SetCameraEnabled(cameras[i], false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GuardCameraController GetCurrentCamera()
|
|
||||||
{
|
|
||||||
return cameras[currentCamera];
|
|
||||||
}
|
|
||||||
|
|
||||||
GuardCameraController GetNextCamera(out int nextCameraPos)
|
|
||||||
{
|
|
||||||
nextCameraPos = (currentCamera + 1) % cameras.Count;
|
|
||||||
return cameras[nextCameraPos];
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwitchCamera()
|
|
||||||
{
|
|
||||||
var nextCam = GetNextCamera(out currentCamera);
|
|
||||||
SetCameraEnabled(nextCam, true);
|
|
||||||
SetCameraEnabled(this, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetCameraEnabled(GuardCameraController gCamera, bool enabled)
|
|
||||||
{
|
|
||||||
gCamera.GetComponent<Camera>().enabled = enabled;
|
|
||||||
gCamera.GetComponent<AudioListener>().enabled = enabled;
|
|
||||||
gCamera.enabled = enabled;
|
|
||||||
gCamera.photonView.RPC("SetEnabledRPC", PhotonTargets.Others, enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update () {
|
|
||||||
if (Input.GetKeyDown("space"))
|
|
||||||
SwitchCamera();
|
|
||||||
|
|
||||||
RaycastHit hit;
|
|
||||||
if (Input.GetButtonDown("Fire1"))
|
|
||||||
{
|
|
||||||
Ray ray = GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
|
|
||||||
|
|
||||||
if (Physics.Raycast(ray, out hit, 100.0f))
|
|
||||||
{
|
|
||||||
if (hit.transform.gameObject.tag == "NPC")
|
|
||||||
{
|
|
||||||
var manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
|
|
||||||
manager.photonView.RPC("ShowSpiesWinScreen", PhotonTargets.All);
|
|
||||||
}
|
|
||||||
else if (hit.transform.gameObject.tag == "Spy")
|
|
||||||
{
|
|
||||||
var manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
|
|
||||||
manager.photonView.RPC("ShowGuardsWinScreen", PhotonTargets.All);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cam.xRotation += Time.deltaTime * Input.GetAxis("Horizontal") * camSens;
|
|
||||||
cam.yRotation += Time.deltaTime * -Input.GetAxis("Vertical") * camSens;
|
|
||||||
cam.xRotation = cam.xRotation % 360;
|
|
||||||
cam.yRotation = Mathf.Clamp(cam.yRotation, -45, 80);
|
|
||||||
cam.UpdateRotation();
|
|
||||||
}
|
|
||||||
}
|
|
120
Project Undercover/Assets/Scripts/Guard/GuardController.cs
Executable file
120
Project Undercover/Assets/Scripts/Guard/GuardController.cs
Executable file
|
@ -0,0 +1,120 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class GuardController : Photon.PunBehaviour {
|
||||||
|
|
||||||
|
public Text cameraStatusText;
|
||||||
|
|
||||||
|
const float CAMERA_SENSITIVITY = 120.0f;
|
||||||
|
|
||||||
|
private int mCurrentCamera;
|
||||||
|
private List<GuardCamera> mCameras;
|
||||||
|
|
||||||
|
private bool mInControl;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
// Fetch all cameras
|
||||||
|
mCameras = new List<GuardCamera>();
|
||||||
|
foreach (var camera in GameObject.FindGameObjectsWithTag("GuardCamera"))
|
||||||
|
{
|
||||||
|
var component = camera.GetComponent<GuardCamera>();
|
||||||
|
if (component != null)
|
||||||
|
{
|
||||||
|
mCameras.Add(component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
mCurrentCamera = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text in the bottom-right corner, denoting if the camera is locked.
|
||||||
|
*/
|
||||||
|
void SetCameraText()
|
||||||
|
{
|
||||||
|
if (mInControl)
|
||||||
|
{
|
||||||
|
cameraStatusText.text = "In-Control";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cameraStatusText.text = "Locked";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cycle the player to the next camera, or grab the first camera
|
||||||
|
* if we don't have one yet.
|
||||||
|
*/
|
||||||
|
void SwitchCamera()
|
||||||
|
{
|
||||||
|
// Get relevant camera indexes
|
||||||
|
int lastCamera = mCurrentCamera;
|
||||||
|
mCurrentCamera += 1;
|
||||||
|
if (mCurrentCamera >= mCameras.Count)
|
||||||
|
{
|
||||||
|
mCurrentCamera = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deactivate the old camera, activate new one
|
||||||
|
mCameras[mCurrentCamera].Activate();
|
||||||
|
if (lastCamera != -1)
|
||||||
|
{
|
||||||
|
mCameras[lastCamera].Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if we are in control.
|
||||||
|
mInControl = mCameras[mCurrentCamera].InControl();
|
||||||
|
SetCameraText();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown("space") || mCurrentCamera == -1)
|
||||||
|
{
|
||||||
|
SwitchCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update camera status text if necessary.
|
||||||
|
bool newInControl = mCameras[mCurrentCamera].InControl();
|
||||||
|
if (newInControl != mInControl)
|
||||||
|
{
|
||||||
|
mInControl = newInControl;
|
||||||
|
SetCameraText();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*RaycastHit hit;
|
||||||
|
if (Input.GetButtonDown("Fire1"))
|
||||||
|
{
|
||||||
|
Ray ray = GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
|
||||||
|
|
||||||
|
if (Physics.Raycast(ray, out hit, 100.0f))
|
||||||
|
{
|
||||||
|
if (hit.transform.gameObject.tag == "NPC")
|
||||||
|
{
|
||||||
|
var manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
|
||||||
|
manager.photonView.RPC("ShowSpiesWinScreen", PhotonTargets.All);
|
||||||
|
}
|
||||||
|
else if (hit.transform.gameObject.tag == "Spy")
|
||||||
|
{
|
||||||
|
var manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
|
||||||
|
manager.photonView.RPC("ShowGuardsWinScreen", PhotonTargets.All);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float xRotation = Time.deltaTime * Input.GetAxis("Horizontal") * CAMERA_SENSITIVITY;
|
||||||
|
float yRotation = Time.deltaTime * -Input.GetAxis("Vertical") * CAMERA_SENSITIVITY;
|
||||||
|
mCameras[mCurrentCamera].Rotate(xRotation, yRotation);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1ef9de564c5529c4faeace3894ec9e0b
|
guid: 828c2a73d6549534cb33b938c6964162
|
||||||
timeCreated: 1505422157
|
timeCreated: 1508202966
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections;
|
||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
@ -7,10 +6,19 @@ using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class GameManager : Photon.PunBehaviour {
|
public class GameManager : Photon.PunBehaviour {
|
||||||
|
|
||||||
public GuardCameraController guardCamera;
|
public GameObject guardController;
|
||||||
public GameObject spyPrefab, NPCPrefab, cameraRigPrefab;
|
public GameObject spyPrefab, NPCPrefab, cameraRigPrefab;
|
||||||
public int numNpcs = 9;
|
public int numNpcs = 9;
|
||||||
|
public int spyMissionsComplete = 0;
|
||||||
|
public float waitBetweenMissions = 5.0f;
|
||||||
|
public bool onMissionCooldown = false;
|
||||||
|
public Text missionsCompleteText;
|
||||||
|
public GameObject winPanel;
|
||||||
|
public GameObject guardPanel;
|
||||||
|
public GameObject spyPanel;
|
||||||
|
public GameObject guardCameraPanel;
|
||||||
|
public Text winText;
|
||||||
|
private int numOfMissions = 3;
|
||||||
|
|
||||||
public override void OnLeftRoom()
|
public override void OnLeftRoom()
|
||||||
{
|
{
|
||||||
|
@ -39,12 +47,12 @@ public class GameManager : Photon.PunBehaviour {
|
||||||
{
|
{
|
||||||
if (PersistantPlayerSettings.character == PersistantPlayerSettings.Character.Guard)
|
if (PersistantPlayerSettings.character == PersistantPlayerSettings.Character.Guard)
|
||||||
{
|
{
|
||||||
guardCamera.SetCameraEnabled(guardCamera, true);
|
guardController.SetActive(true);
|
||||||
|
guardCameraPanel.SetActive(true);
|
||||||
//guardPanel.SetActive(true);
|
//guardPanel.SetActive(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Collections;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Com.MyCompany.MyGame
|
namespace Com.MyCompany.MyGame
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(InputField))]
|
[RequireComponent(typeof(InputField))]
|
||||||
|
|
1
Project Undercover/ProjectSettings/DynamicsManager.asset
Normal file → Executable file
1
Project Undercover/ProjectSettings/DynamicsManager.asset
Normal file → Executable file
|
@ -17,3 +17,4 @@ PhysicsManager:
|
||||||
m_EnablePCM: 1
|
m_EnablePCM: 1
|
||||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||||
m_AutoSimulation: 1
|
m_AutoSimulation: 1
|
||||||
|
m_AutoSyncTransforms: 1
|
||||||
|
|
5
Project Undercover/ProjectSettings/EditorBuildSettings.asset
Normal file → Executable file
5
Project Undercover/ProjectSettings/EditorBuildSettings.asset
Normal file → Executable file
|
@ -12,8 +12,11 @@ EditorBuildSettings:
|
||||||
path: Assets/Scenes/Lobby.unity
|
path: Assets/Scenes/Lobby.unity
|
||||||
guid: 9d65756f3d12ef647aea0782245fc241
|
guid: 9d65756f3d12ef647aea0782245fc241
|
||||||
- enabled: 0
|
- enabled: 0
|
||||||
path: Assets/Scenes/scene.unity
|
path:
|
||||||
guid: b679f50ae448b0642b9887e440a00e0f
|
guid: b679f50ae448b0642b9887e440a00e0f
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/NewCharactersTest.unity
|
path: Assets/Scenes/NewCharactersTest.unity
|
||||||
guid: 89e17cc55d8d66942862d86930906b5f
|
guid: 89e17cc55d8d66942862d86930906b5f
|
||||||
|
- enabled: 0
|
||||||
|
path: Assets/Scenes/GuardCameraTest.unity
|
||||||
|
guid: e6ffeb27a9cb4a244bc7c814c7346df2
|
||||||
|
|
1
Project Undercover/ProjectSettings/Physics2DSettings.asset
Normal file → Executable file
1
Project Undercover/ProjectSettings/Physics2DSettings.asset
Normal file → Executable file
|
@ -24,6 +24,7 @@ Physics2DSettings:
|
||||||
m_QueriesStartInColliders: 1
|
m_QueriesStartInColliders: 1
|
||||||
m_ChangeStopsCallbacks: 0
|
m_ChangeStopsCallbacks: 0
|
||||||
m_CallbacksOnDisable: 1
|
m_CallbacksOnDisable: 1
|
||||||
|
m_AutoSyncTransforms: 1
|
||||||
m_AlwaysShowColliders: 0
|
m_AlwaysShowColliders: 0
|
||||||
m_ShowColliderSleep: 1
|
m_ShowColliderSleep: 1
|
||||||
m_ShowColliderContacts: 0
|
m_ShowColliderContacts: 0
|
||||||
|
|
3
Project Undercover/ProjectSettings/ProjectSettings.asset
Normal file → Executable file
3
Project Undercover/ProjectSettings/ProjectSettings.asset
Normal file → Executable file
|
@ -368,9 +368,6 @@ PlayerSettings:
|
||||||
switchUdpSendBufferSize: 9
|
switchUdpSendBufferSize: 9
|
||||||
switchUdpReceiveBufferSize: 42
|
switchUdpReceiveBufferSize: 42
|
||||||
switchSocketBufferEfficiency: 4
|
switchSocketBufferEfficiency: 4
|
||||||
switchSocketInitializeEnabled: 1
|
|
||||||
switchNetworkInterfaceManagerInitializeEnabled: 1
|
|
||||||
switchPlayerConnectionEnabled: 1
|
|
||||||
ps4NPAgeRating: 12
|
ps4NPAgeRating: 12
|
||||||
ps4NPTitleSecret:
|
ps4NPTitleSecret:
|
||||||
ps4NPTrophyPackPath:
|
ps4NPTrophyPackPath:
|
||||||
|
|
2
Project Undercover/ProjectSettings/TagManager.asset
Normal file → Executable file
2
Project Undercover/ProjectSettings/TagManager.asset
Normal file → Executable file
|
@ -8,6 +8,8 @@ TagManager:
|
||||||
- GameManager
|
- GameManager
|
||||||
- Spy
|
- Spy
|
||||||
- NPC
|
- NPC
|
||||||
|
- GuardController
|
||||||
|
- GuardPanel
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|
Reference in a new issue