cam more
This commit is contained in:
@@ -381,7 +381,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 2658980241334070197}
|
m_GameObject: {fileID: 2658980241334070197}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0.07358181, y: 0.06576601, z: -0.0048629786, w: 0.99510646}
|
m_LocalRotation: {x: 0.07358181, y: 0.06576601, z: -0.0048629786, w: 0.99510646}
|
||||||
m_LocalPosition: {x: 0.021, y: 0.554, z: -5.19}
|
m_LocalPosition: {x: 0.020576129, y: 0.55308634, z: -10.600001}
|
||||||
m_LocalScale: {x: 0.41152364, y: 0.2469134, z: 1}
|
m_LocalScale: {x: 0.41152364, y: 0.2469134, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -747,7 +747,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 5594795846395120415}
|
m_GameObject: {fileID: 5594795846395120415}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0.021, y: 0.554, z: -5.19}
|
m_LocalPosition: {x: 0.021, y: 0.554, z: -9.62}
|
||||||
m_LocalScale: {x: 0.4115226, y: 0.24691355, z: 1}
|
m_LocalScale: {x: 0.4115226, y: 0.24691355, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -782,9 +782,9 @@ MonoBehaviour:
|
|||||||
- m_EditModeType: 1
|
- m_EditModeType: 1
|
||||||
m_Knots:
|
m_Knots:
|
||||||
- Position:
|
- Position:
|
||||||
x: 0
|
x: -0.0010300055
|
||||||
y: 0
|
y: -0.0037002563
|
||||||
z: 0
|
z: -0.98000145
|
||||||
TangentIn:
|
TangentIn:
|
||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
@@ -802,7 +802,7 @@ MonoBehaviour:
|
|||||||
- Position:
|
- Position:
|
||||||
x: -0.19103001
|
x: -0.19103001
|
||||||
y: -0.0037002563
|
y: -0.0037002563
|
||||||
z: 10.25
|
z: 21.71
|
||||||
TangentIn:
|
TangentIn:
|
||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ce995914cc8af1826b3ca2eae230fa5f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+272
-64
@@ -4684,37 +4684,6 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 794486860}
|
m_GameObject: {fileID: 794486860}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
--- !u!1 &813747523
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 813747524}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: CamStartPos
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &813747524
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 813747523}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 24.62, y: 5, z: -42.67}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &823145082
|
--- !u!1 &823145082
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -5662,6 +5631,132 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1010843661}
|
m_GameObject: {fileID: 1010843661}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!1 &1026739743
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1026739746}
|
||||||
|
- component: {fileID: 1026739745}
|
||||||
|
- component: {fileID: 1026739744}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Dolly Spline
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &1026739744
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1026739743}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c5342500578afb24a9b83d6343d32a0f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineSplineSmoother
|
||||||
|
AutoSmooth: 1
|
||||||
|
--- !u!114 &1026739745
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1026739743}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dab5c7d4c32e743048dfca98e2d5914f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Splines::UnityEngine.Splines.SplineContainer
|
||||||
|
m_Spline:
|
||||||
|
m_EditModeType: 1
|
||||||
|
m_Knots: []
|
||||||
|
m_MetaData: []
|
||||||
|
m_Closed: 0
|
||||||
|
m_IntData:
|
||||||
|
m_Data: []
|
||||||
|
m_FloatData:
|
||||||
|
m_Data: []
|
||||||
|
m_Float4Data:
|
||||||
|
m_Data: []
|
||||||
|
m_ObjectData:
|
||||||
|
m_Data: []
|
||||||
|
m_Splines:
|
||||||
|
- m_EditModeType: 1
|
||||||
|
m_Knots:
|
||||||
|
- Position:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: -0.06800079
|
||||||
|
TangentIn:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: 0
|
||||||
|
TangentOut:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: 0
|
||||||
|
Rotation:
|
||||||
|
value:
|
||||||
|
x: -0.19298117
|
||||||
|
y: 0.25777513
|
||||||
|
z: 0.0526258
|
||||||
|
w: 0.94527286
|
||||||
|
- Position:
|
||||||
|
x: 0.7800007
|
||||||
|
y: 0.65999985
|
||||||
|
z: 21.761
|
||||||
|
TangentIn:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: -0.55701405
|
||||||
|
TangentOut:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: 0.55701405
|
||||||
|
Rotation:
|
||||||
|
value:
|
||||||
|
x: -0.19298117
|
||||||
|
y: 0.25777513
|
||||||
|
z: 0.0526258
|
||||||
|
w: 0.94527286
|
||||||
|
m_MetaData:
|
||||||
|
- Mode: 1
|
||||||
|
Tension: 0.5
|
||||||
|
- Mode: 2
|
||||||
|
Tension: 0.5
|
||||||
|
m_Closed: 0
|
||||||
|
m_IntData:
|
||||||
|
m_Data: []
|
||||||
|
m_FloatData:
|
||||||
|
m_Data: []
|
||||||
|
m_Float4Data:
|
||||||
|
m_Data: []
|
||||||
|
m_ObjectData:
|
||||||
|
m_Data: []
|
||||||
|
m_Knots:
|
||||||
|
m_KnotsLink: []
|
||||||
|
--- !u!4 &1026739746
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1026739743}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 25, y: 5, z: -52}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1033540269
|
--- !u!1 &1033540269
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -7733,6 +7828,146 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1384402512}
|
m_GameObject: {fileID: 1384402512}
|
||||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!1 &1419548891
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1419548895}
|
||||||
|
- component: {fileID: 1419548894}
|
||||||
|
- component: {fileID: 1419548893}
|
||||||
|
- component: {fileID: 1419548892}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: IntroCam
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &1419548892
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1419548891}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineRotationComposer
|
||||||
|
Composition:
|
||||||
|
ScreenPosition: {x: 0, y: 0}
|
||||||
|
DeadZone:
|
||||||
|
Enabled: 0
|
||||||
|
Size: {x: 0.2, y: 0.2}
|
||||||
|
HardLimits:
|
||||||
|
Enabled: 0
|
||||||
|
Size: {x: 0.8, y: 0.8}
|
||||||
|
Offset: {x: 0, y: 0}
|
||||||
|
CenterOnActivate: 1
|
||||||
|
TargetOffset: {x: 0, y: 0, z: 0}
|
||||||
|
Damping: {x: 0.5, y: 0.5}
|
||||||
|
Lookahead:
|
||||||
|
Enabled: 0
|
||||||
|
Time: 0
|
||||||
|
Smoothing: 0
|
||||||
|
IgnoreY: 0
|
||||||
|
--- !u!114 &1419548893
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1419548891}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 90eebaab98e4b44b0ba8c79821e554e1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineSplineDolly
|
||||||
|
m_SplineSettings:
|
||||||
|
Spline: {fileID: 1026739745}
|
||||||
|
Position: 0
|
||||||
|
Units: 1
|
||||||
|
SplineOffset: {x: 0, y: 0, z: 0}
|
||||||
|
CameraRotation: 0
|
||||||
|
Damping:
|
||||||
|
Enabled: 0
|
||||||
|
Position: {x: 0, y: 0, z: 0}
|
||||||
|
Angular: 0
|
||||||
|
AutomaticDolly:
|
||||||
|
Enabled: 0
|
||||||
|
Method:
|
||||||
|
rid: -2
|
||||||
|
m_LegacyPosition: -1
|
||||||
|
m_LegacyUnits: 0
|
||||||
|
m_LegacySpline: {fileID: 0}
|
||||||
|
references:
|
||||||
|
version: 2
|
||||||
|
RefIds:
|
||||||
|
- rid: -2
|
||||||
|
type: {class: , ns: , asm: }
|
||||||
|
--- !u!114 &1419548894
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1419548891}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera
|
||||||
|
Priority:
|
||||||
|
Enabled: 0
|
||||||
|
m_Value: 0
|
||||||
|
OutputChannel: 1
|
||||||
|
StandbyUpdate: 2
|
||||||
|
m_StreamingVersion: 20241001
|
||||||
|
m_LegacyPriority: 0
|
||||||
|
Target:
|
||||||
|
TrackingTarget: {fileID: 0}
|
||||||
|
LookAtTarget: {fileID: 0}
|
||||||
|
CustomLookAtTarget: 0
|
||||||
|
Lens:
|
||||||
|
FieldOfView: 60.000004
|
||||||
|
OrthographicSize: 5
|
||||||
|
NearClipPlane: 0.3
|
||||||
|
FarClipPlane: 1000
|
||||||
|
Dutch: 0
|
||||||
|
ModeOverride: 0
|
||||||
|
PhysicalProperties:
|
||||||
|
GateFit: 2
|
||||||
|
SensorSize: {x: 21.946, y: 16.002}
|
||||||
|
LensShift: {x: 0, y: 0}
|
||||||
|
FocusDistance: 10
|
||||||
|
Iso: 200
|
||||||
|
ShutterSpeed: 0.005
|
||||||
|
Aperture: 16
|
||||||
|
BladeCount: 5
|
||||||
|
Curvature: {x: 2, y: 11}
|
||||||
|
BarrelClipping: 0.25
|
||||||
|
Anamorphism: 0
|
||||||
|
BlendHint: 0
|
||||||
|
--- !u!4 &1419548895
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1419548891}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 25, y: 5, z: -52.068}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1425902180
|
--- !u!1 &1425902180
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -9168,6 +9403,10 @@ MonoBehaviour:
|
|||||||
explorationCamera: {fileID: 17649578}
|
explorationCamera: {fileID: 17649578}
|
||||||
activePriority: 20
|
activePriority: 20
|
||||||
inactivePriority: 10
|
inactivePriority: 10
|
||||||
|
introCamera: {fileID: 1419548894}
|
||||||
|
introSplineDolly: {fileID: 1419548893}
|
||||||
|
introHoldTime: 0
|
||||||
|
blendDuration: 0
|
||||||
mainUnityCamera: {fileID: 330585545}
|
mainUnityCamera: {fileID: 330585545}
|
||||||
interactableLayer:
|
interactableLayer:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -10427,37 +10666,6 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: -20, y: -20}
|
m_SizeDelta: {x: -20, y: -20}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &2057252392
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 2057252393}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: CamPlayPos
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &2057252393
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2057252392}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 25, y: 5, z: -30}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &2068975855
|
--- !u!1 &2068975855
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -10777,5 +10985,5 @@ SceneRoots:
|
|||||||
- {fileID: 17649579}
|
- {fileID: 17649579}
|
||||||
- {fileID: 1277677658}
|
- {fileID: 1277677658}
|
||||||
- {fileID: 1743187106}
|
- {fileID: 1743187106}
|
||||||
- {fileID: 813747524}
|
- {fileID: 1419548895}
|
||||||
- {fileID: 2057252393}
|
- {fileID: 1026739746}
|
||||||
|
|||||||
+357
-314
@@ -7,350 +7,393 @@ using System.Collections;
|
|||||||
|
|
||||||
public class CameraController : MonoBehaviour
|
public class CameraController : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("Cinemachine 3 Setup")]
|
[Header("Cinemachine 3 Setup")]
|
||||||
public CinemachineCamera focusCameraA;
|
public CinemachineCamera focusCameraA;
|
||||||
public CinemachineCamera focusCameraB;
|
public CinemachineCamera focusCameraB;
|
||||||
public CinemachineCamera explorationCamera;
|
public CinemachineCamera explorationCamera;
|
||||||
|
|
||||||
|
public int activePriority = 20;
|
||||||
|
public int inactivePriority = 10;
|
||||||
|
|
||||||
public int activePriority = 20;
|
[Header("Intro Sequence Setup")]
|
||||||
public int inactivePriority = 10;
|
[Tooltip("The camera placed high up to show the whole room.")]
|
||||||
|
public CinemachineCamera introCamera;
|
||||||
|
public CinemachineSplineDolly introSplineDolly;
|
||||||
|
|
||||||
|
public float introHoldTime = 2f;
|
||||||
|
[Tooltip("How long the Cinemachine blend takes to sweep down to the player.")]
|
||||||
|
public float blendDuration = 2f;
|
||||||
|
|
||||||
[Header("Raycast Setup")]
|
[Header("Raycast Setup")]
|
||||||
public Camera mainUnityCamera;
|
public Camera mainUnityCamera;
|
||||||
public LayerMask interactableLayer;
|
public LayerMask interactableLayer;
|
||||||
|
|
||||||
[Header("UI Setup")]
|
[Header("UI Setup")]
|
||||||
public Button talkButton;
|
public Button talkButton;
|
||||||
public Button doorButton;
|
public Button doorButton;
|
||||||
private GuardManager currentGuardManager;
|
private GuardManager currentGuardManager;
|
||||||
private DoorManager currentDoorManager;
|
private DoorManager currentDoorManager;
|
||||||
|
|
||||||
[Header("Hover Highlight Settings")]
|
[Header("Hover Highlight Settings")]
|
||||||
public Color highlightColour = Color.yellow;
|
public Color highlightColour = Color.yellow;
|
||||||
private Renderer currentlyHoveredRenderer;
|
private Renderer currentlyHoveredRenderer;
|
||||||
private Color originalColour;
|
private Color originalColour;
|
||||||
|
|
||||||
[Header("Exploration Nudge Settings")]
|
[Header("Exploration Nudge Settings")]
|
||||||
public float nudgeSpeed = 15f;
|
public float nudgeSpeed = 15f;
|
||||||
public float maxNudgeAngle = 8f;
|
public float maxNudgeAngle = 8f;
|
||||||
public float edgeThickness = 50f;
|
public float edgeThickness = 50f;
|
||||||
|
|
||||||
[Header("Focus Nudge Settings")]
|
[Header("Focus Nudge Settings")]
|
||||||
public float focusNudgeSpeed = 5f;
|
public float focusNudgeSpeed = 5f;
|
||||||
public float maxFocusOffset = 2f;
|
public float maxFocusOffset = 2f;
|
||||||
|
|
||||||
private Quaternion startingRotation;
|
private Quaternion startingRotation;
|
||||||
private float currentYaw = 0f;
|
private float currentYaw = 0f;
|
||||||
|
|
||||||
private bool useCameraA = true;
|
private bool useCameraA = true;
|
||||||
private Transform dynamicFocusTargetA;
|
private Transform dynamicFocusTargetA;
|
||||||
private Transform dynamicFocusTargetB;
|
private Transform dynamicFocusTargetB;
|
||||||
private Transform activeDynamicTarget;
|
private Transform activeDynamicTarget;
|
||||||
private Transform currentInteractableTransform;
|
private Transform currentInteractableTransform;
|
||||||
|
|
||||||
|
private float currentFocusOffsetX = 0f;
|
||||||
|
private bool isSequencePlaying = false;
|
||||||
|
|
||||||
private float currentFocusOffsetX = 0f;
|
void Start()
|
||||||
private bool isSequencePlaying = false;
|
{
|
||||||
|
if (explorationCamera != null)
|
||||||
|
{
|
||||||
|
startingRotation = explorationCamera.transform.rotation;
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
dynamicFocusTargetA = new GameObject("DynamicFocusTarget_A").transform;
|
||||||
|
dynamicFocusTargetB = new GameObject("DynamicFocusTarget_B").transform;
|
||||||
|
|
||||||
|
if (talkButton != null)
|
||||||
|
{
|
||||||
|
talkButton.gameObject.SetActive(false);
|
||||||
|
talkButton.onClick.AddListener(OnTalkButtonClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doorButton != null)
|
||||||
|
{
|
||||||
|
doorButton.gameObject.SetActive(false);
|
||||||
|
doorButton.onClick.AddListener(OnDoorButtonClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Play the intro sweep straight away when the game first loads!
|
||||||
|
if (introCamera != null)
|
||||||
|
{
|
||||||
|
StartCoroutine(IntroSequenceRoutine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
// Allow the Escape key to skip intro sequences or drop interactions at any time
|
||||||
|
if (Keyboard.current != null && Keyboard.current.escapeKey.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
StopAllCoroutines();
|
||||||
|
isSequencePlaying = false;
|
||||||
|
ResetCameraPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mouse.current == null || isSequencePlaying) return;
|
||||||
|
|
||||||
|
HandleHover();
|
||||||
|
HandleEdgeNudge();
|
||||||
|
|
||||||
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HandleInteractionClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mouse.current.rightButton.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
ReturnToMainCamera();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator IntroSequenceRoutine()
|
||||||
{
|
{
|
||||||
if (explorationCamera != null)
|
// If you haven't assigned an intro camera yet, just skip this
|
||||||
{
|
if (introCamera == null) yield break;
|
||||||
startingRotation = explorationCamera.transform.rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamicFocusTargetA = new GameObject("DynamicFocusTarget_A").transform;
|
// Lock controls
|
||||||
dynamicFocusTargetB = new GameObject("DynamicFocusTarget_B").transform;
|
|
||||||
|
|
||||||
if (talkButton != null)
|
|
||||||
{
|
|
||||||
talkButton.gameObject.SetActive(false);
|
|
||||||
talkButton.onClick.AddListener(OnTalkButtonClicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doorButton != null)
|
|
||||||
{
|
|
||||||
doorButton.gameObject.SetActive(false);
|
|
||||||
doorButton.onClick.AddListener(OnDoorButtonClicked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if (Mouse.current == null || isSequencePlaying) return;
|
|
||||||
|
|
||||||
HandleHover();
|
|
||||||
HandleEdgeNudge();
|
|
||||||
|
|
||||||
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
||||||
{
|
|
||||||
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
HandleInteractionClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Mouse.current.rightButton.wasPressedThisFrame)
|
|
||||||
{
|
|
||||||
ReturnToMainCamera();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Keyboard.current != null && Keyboard.current.escapeKey.wasPressedThisFrame)
|
|
||||||
{
|
|
||||||
ResetCameraPositions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleEdgeNudge()
|
|
||||||
{
|
|
||||||
Vector2 mousePos = Mouse.current.position.ReadValue();
|
|
||||||
float yawInput = 0f;
|
|
||||||
|
|
||||||
if (mousePos.x < edgeThickness) yawInput = -1f;
|
|
||||||
else if (mousePos.x > Screen.width - edgeThickness) yawInput = 1f;
|
|
||||||
|
|
||||||
bool isFocused = focusCameraA.Priority >= activePriority || focusCameraB.Priority >= activePriority;
|
|
||||||
|
|
||||||
if (yawInput != 0f)
|
|
||||||
{
|
|
||||||
if (isFocused && currentInteractableTransform != null && activeDynamicTarget != null)
|
|
||||||
{
|
|
||||||
currentFocusOffsetX += yawInput * focusNudgeSpeed * Time.deltaTime;
|
|
||||||
currentFocusOffsetX = Mathf.Clamp(currentFocusOffsetX, -maxFocusOffset, maxFocusOffset);
|
|
||||||
|
|
||||||
activeDynamicTarget.position = currentInteractableTransform.position
|
|
||||||
+ (mainUnityCamera.transform.right * currentFocusOffsetX);
|
|
||||||
}
|
|
||||||
else if (!isFocused && explorationCamera != null)
|
|
||||||
{
|
|
||||||
currentYaw += yawInput * nudgeSpeed * Time.deltaTime;
|
|
||||||
currentYaw = Mathf.Clamp(currentYaw, -maxNudgeAngle, maxNudgeAngle);
|
|
||||||
|
|
||||||
Quaternion yawRotation = Quaternion.AngleAxis(currentYaw, Vector3.up);
|
|
||||||
explorationCamera.transform.rotation = startingRotation * yawRotation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleHover()
|
|
||||||
{
|
|
||||||
Vector2 mousePos = Mouse.current.position.ReadValue();
|
|
||||||
Ray ray = mainUnityCamera.ScreenPointToRay(mousePos);
|
|
||||||
|
|
||||||
if (Physics.Raycast(ray, out RaycastHit hit, 100f, interactableLayer))
|
|
||||||
{
|
|
||||||
Renderer hitRenderer = hit.transform.GetComponentInChildren<Renderer>();
|
|
||||||
|
|
||||||
if (hitRenderer != null && hitRenderer != currentlyHoveredRenderer)
|
|
||||||
{
|
|
||||||
RemoveHighlight();
|
|
||||||
currentlyHoveredRenderer = hitRenderer;
|
|
||||||
|
|
||||||
if (
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>() != null &&
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>() != currentDoorManager
|
|
||||||
)
|
|
||||||
{
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>().isfocussed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>() != null &&
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>() != currentGuardManager
|
|
||||||
)
|
|
||||||
{
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>().isfocussed = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RemoveHighlight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveHighlight()
|
|
||||||
{
|
|
||||||
if (currentlyHoveredRenderer != null)
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>() != null &&
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>() != currentDoorManager
|
|
||||||
)
|
|
||||||
{
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>().isfocussed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>() != null &&
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>() != currentGuardManager
|
|
||||||
)
|
|
||||||
{
|
|
||||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>().isfocussed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentlyHoveredRenderer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleInteractionClick()
|
|
||||||
{
|
|
||||||
Vector2 mousePos = Mouse.current.position.ReadValue();
|
|
||||||
Ray ray = mainUnityCamera.ScreenPointToRay(mousePos);
|
|
||||||
|
|
||||||
if (Physics.Raycast(ray, out RaycastHit hit, 100f, interactableLayer))
|
|
||||||
{
|
|
||||||
currentInteractableTransform = hit.transform;
|
|
||||||
currentFocusOffsetX = 0f;
|
|
||||||
|
|
||||||
CinemachineCamera nextCam = useCameraA ? focusCameraA : focusCameraB;
|
|
||||||
CinemachineCamera oldCam = useCameraA ? focusCameraB : focusCameraA;
|
|
||||||
Transform nextTarget = useCameraA ? dynamicFocusTargetA : dynamicFocusTargetB;
|
|
||||||
|
|
||||||
nextTarget.position = currentInteractableTransform.position;
|
|
||||||
nextCam.Follow = currentInteractableTransform;
|
|
||||||
nextCam.LookAt = nextTarget;
|
|
||||||
|
|
||||||
nextCam.Priority = activePriority;
|
|
||||||
oldCam.Priority = inactivePriority;
|
|
||||||
|
|
||||||
activeDynamicTarget = nextTarget;
|
|
||||||
useCameraA = !useCameraA;
|
|
||||||
|
|
||||||
GuardManager guard = hit.transform.GetComponent<GuardManager>();
|
|
||||||
DoorManager door = hit.transform.GetComponent<DoorManager>();
|
|
||||||
|
|
||||||
if (talkButton != null) talkButton.gameObject.SetActive(false);
|
|
||||||
if (doorButton != null) doorButton.gameObject.SetActive(false);
|
|
||||||
|
|
||||||
UnsetAll();
|
|
||||||
|
|
||||||
if (guard != null)
|
|
||||||
{
|
|
||||||
TutorialManager.Instance.LogAction("TAP");
|
|
||||||
currentGuardManager = guard;
|
|
||||||
guard.isfocussed = 2;
|
|
||||||
if (talkButton != null) talkButton.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
else if (door != null)
|
|
||||||
{
|
|
||||||
TutorialManager.Instance.LogAction("TAP");
|
|
||||||
currentDoorManager = door;
|
|
||||||
door.isfocussed = 2;
|
|
||||||
if (doorButton != null) doorButton.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ReturnToMainCamera();
|
|
||||||
UnsetAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTalkButtonClicked()
|
|
||||||
{
|
|
||||||
if (currentGuardManager != null)
|
|
||||||
{
|
|
||||||
DialogManager.Instance.StartDialog(currentGuardManager);
|
|
||||||
// talkButton.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDoorButtonClicked()
|
|
||||||
{
|
|
||||||
if (currentDoorManager != null && currentDoorManager.doorCamera != null && currentDoorManager.doorSplineDolly != null)
|
|
||||||
{
|
|
||||||
doorButton.gameObject.SetActive(false);
|
|
||||||
StartCoroutine(DoorSequenceRoutine(currentDoorManager));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError("The DoorManager is missing its Camera or Spline Dolly references!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator DoorSequenceRoutine(DoorManager activeDoor)
|
|
||||||
{
|
|
||||||
isSequencePlaying = true;
|
isSequencePlaying = true;
|
||||||
RemoveHighlight();
|
RemoveHighlight();
|
||||||
|
|
||||||
activeDoor.doorSplineDolly.CameraPosition = 0f;
|
// If we have a track, reset the camera to the very start of it
|
||||||
activeDoor.doorCamera.Priority = 30;
|
if (introSplineDolly != null)
|
||||||
|
|
||||||
yield return new WaitForSeconds(0.5f);
|
|
||||||
|
|
||||||
float pushSpeed = 0.5f;
|
|
||||||
|
|
||||||
// Push the camera through the doorway
|
|
||||||
while (activeDoor.doorSplineDolly.CameraPosition < 1f)
|
|
||||||
{
|
{
|
||||||
activeDoor.doorSplineDolly.CameraPosition += pushSpeed * Time.deltaTime;
|
introSplineDolly.CameraPosition = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Snap to the intro camera
|
||||||
|
introCamera.Priority = 30;
|
||||||
|
|
||||||
|
// If we have a track, push the camera along it smoothly!
|
||||||
|
if (introSplineDolly != null)
|
||||||
|
{
|
||||||
|
float elapsedTime = 0f;
|
||||||
|
while (elapsedTime < introHoldTime)
|
||||||
|
{
|
||||||
|
elapsedTime += Time.deltaTime;
|
||||||
|
// This maths magically moves it from 0 to 1 perfectly timed to your introHoldTime
|
||||||
|
introSplineDolly.CameraPosition = Mathf.Lerp(0f, 1f, elapsedTime / introHoldTime);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeDoor.doorSplineDolly.CameraPosition = 1f;
|
// Make sure it snaps perfectly to the end (1.0)
|
||||||
|
introSplineDolly.CameraPosition = 1f;
|
||||||
yield return new WaitForSeconds(2.0f);
|
|
||||||
|
|
||||||
// The camera is now inside the room. Let's check what kind of door it was!
|
|
||||||
if (activeDoor.type == "LIFE")
|
|
||||||
{
|
|
||||||
Debug.Log("Safe door chosen! Advancing to the next level.");
|
|
||||||
GlobalStateManager.Instance.SetLevelCompleted();
|
|
||||||
}
|
|
||||||
else if (activeDoor.type == "DEATH")
|
|
||||||
{
|
|
||||||
Debug.Log("Wrong door! The player has met a grim fate.");
|
|
||||||
|
|
||||||
// Add your death screen or level restart logic here!
|
|
||||||
// For example: GlobalStateManager.Instance.TriggerGameOver();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"Door type '{activeDoor.type}' is not recognised for level transitions.");
|
// If you didn't plug in a spline, just wait normally
|
||||||
}
|
yield return new WaitForSeconds(introHoldTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReturnToMainCamera()
|
// Drop priority so Cinemachine blends down to the exploration camera
|
||||||
{
|
introCamera.Priority = inactivePriority;
|
||||||
focusCameraA.Priority = inactivePriority;
|
|
||||||
focusCameraB.Priority = inactivePriority;
|
|
||||||
|
|
||||||
focusCameraA.Follow = null; focusCameraA.LookAt = null;
|
// Wait whilst the camera physically travels downwards
|
||||||
focusCameraB.Follow = null; focusCameraB.LookAt = null;
|
yield return new WaitForSeconds(blendDuration);
|
||||||
|
|
||||||
currentInteractableTransform = null;
|
// Unlock controls
|
||||||
activeDynamicTarget = null;
|
isSequencePlaying = false;
|
||||||
currentGuardManager = null;
|
|
||||||
currentDoorManager = null;
|
|
||||||
|
|
||||||
if (talkButton != null) talkButton.gameObject.SetActive(false);
|
|
||||||
if (doorButton != null) doorButton.gameObject.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnsetAll()
|
private IEnumerator DoorSequenceRoutine(DoorManager activeDoor)
|
||||||
{
|
{
|
||||||
foreach (var doorManager in LevelLoader.Instance.Doors)
|
isSequencePlaying = true;
|
||||||
{
|
RemoveHighlight();
|
||||||
doorManager.isfocussed = 0;
|
|
||||||
}
|
activeDoor.doorSplineDolly.CameraPosition = 0f;
|
||||||
foreach (var doorManager in LevelLoader.Instance.Guards)
|
activeDoor.doorCamera.Priority = 30;
|
||||||
{
|
|
||||||
doorManager.isfocussed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
yield return new WaitForSeconds(0.5f);
|
||||||
|
|
||||||
private void ResetCameraPositions()
|
float pushSpeed = 0.5f;
|
||||||
{
|
|
||||||
ReturnToMainCamera();
|
// Push the camera through the doorway safely
|
||||||
|
while (activeDoor != null && activeDoor.doorSplineDolly != null && activeDoor.doorSplineDolly.CameraPosition < 1f)
|
||||||
|
{
|
||||||
|
activeDoor.doorSplineDolly.CameraPosition += pushSpeed * Time.deltaTime;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
currentFocusOffsetX = 0f;
|
// Cache the type just in case the door is destroyed during level generation
|
||||||
currentYaw = 0f;
|
string doorType = activeDoor != null ? activeDoor.type : "";
|
||||||
|
|
||||||
if (explorationCamera != null)
|
// Drop the door camera's priority BEFORE we update the level
|
||||||
{
|
if (activeDoor != null && activeDoor.doorCamera != null)
|
||||||
explorationCamera.transform.rotation = startingRotation;
|
{
|
||||||
}
|
activeDoor.doorCamera.Priority = inactivePriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trigger your level update logic
|
||||||
|
if (doorType == "LIFE")
|
||||||
|
{
|
||||||
|
Debug.Log("Safe door chosen! Advancing to the next level.");
|
||||||
|
GlobalStateManager.Instance.SetLevelCompleted();
|
||||||
|
}
|
||||||
|
else if (doorType == "DEATH")
|
||||||
|
{
|
||||||
|
Debug.Log("Wrong door! Teleporting back to start.");
|
||||||
|
// Your death logic goes here!
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Door type '{doorType}' is not recognised.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Play the intro sequence for the newly generated room
|
||||||
|
yield return StartCoroutine(IntroSequenceRoutine());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleEdgeNudge()
|
||||||
|
{
|
||||||
|
Vector2 mousePos = Mouse.current.position.ReadValue();
|
||||||
|
float yawInput = 0f;
|
||||||
|
|
||||||
|
if (mousePos.x < edgeThickness) yawInput = -1f;
|
||||||
|
else if (mousePos.x > Screen.width - edgeThickness) yawInput = 1f;
|
||||||
|
|
||||||
|
bool isFocused = focusCameraA.Priority >= activePriority || focusCameraB.Priority >= activePriority;
|
||||||
|
|
||||||
|
if (yawInput != 0f)
|
||||||
|
{
|
||||||
|
if (isFocused && currentInteractableTransform != null && activeDynamicTarget != null)
|
||||||
|
{
|
||||||
|
currentFocusOffsetX += yawInput * focusNudgeSpeed * Time.deltaTime;
|
||||||
|
currentFocusOffsetX = Mathf.Clamp(currentFocusOffsetX, -maxFocusOffset, maxFocusOffset);
|
||||||
|
|
||||||
|
activeDynamicTarget.position = currentInteractableTransform.position
|
||||||
|
+ (mainUnityCamera.transform.right * currentFocusOffsetX);
|
||||||
|
}
|
||||||
|
else if (!isFocused && explorationCamera != null)
|
||||||
|
{
|
||||||
|
currentYaw += yawInput * nudgeSpeed * Time.deltaTime;
|
||||||
|
currentYaw = Mathf.Clamp(currentYaw, -maxNudgeAngle, maxNudgeAngle);
|
||||||
|
|
||||||
|
Quaternion yawRotation = Quaternion.AngleAxis(currentYaw, Vector3.up);
|
||||||
|
explorationCamera.transform.rotation = startingRotation * yawRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleHover()
|
||||||
|
{
|
||||||
|
Vector2 mousePos = Mouse.current.position.ReadValue();
|
||||||
|
Ray ray = mainUnityCamera.ScreenPointToRay(mousePos);
|
||||||
|
|
||||||
|
if (Physics.Raycast(ray, out RaycastHit hit, 100f, interactableLayer))
|
||||||
|
{
|
||||||
|
Renderer hitRenderer = hit.transform.GetComponentInChildren<Renderer>();
|
||||||
|
|
||||||
|
if (hitRenderer != null && hitRenderer != currentlyHoveredRenderer)
|
||||||
|
{
|
||||||
|
RemoveHighlight();
|
||||||
|
currentlyHoveredRenderer = hitRenderer;
|
||||||
|
|
||||||
|
if (currentlyHoveredRenderer is SpriteRenderer sprite)
|
||||||
|
{
|
||||||
|
originalColour = sprite.color;
|
||||||
|
sprite.color = highlightColour;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
originalColour = currentlyHoveredRenderer.material.color;
|
||||||
|
currentlyHoveredRenderer.material.color = highlightColour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoveHighlight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveHighlight()
|
||||||
|
{
|
||||||
|
if (currentlyHoveredRenderer != null)
|
||||||
|
{
|
||||||
|
if (currentlyHoveredRenderer is SpriteRenderer sprite)
|
||||||
|
{
|
||||||
|
sprite.color = originalColour;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentlyHoveredRenderer.material.color = originalColour;
|
||||||
|
}
|
||||||
|
currentlyHoveredRenderer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleInteractionClick()
|
||||||
|
{
|
||||||
|
Vector2 mousePos = Mouse.current.position.ReadValue();
|
||||||
|
Ray ray = mainUnityCamera.ScreenPointToRay(mousePos);
|
||||||
|
|
||||||
|
if (Physics.Raycast(ray, out RaycastHit hit, 100f, interactableLayer))
|
||||||
|
{
|
||||||
|
currentInteractableTransform = hit.transform;
|
||||||
|
currentFocusOffsetX = 0f;
|
||||||
|
|
||||||
|
CinemachineCamera nextCam = useCameraA ? focusCameraA : focusCameraB;
|
||||||
|
CinemachineCamera oldCam = useCameraA ? focusCameraB : focusCameraA;
|
||||||
|
Transform nextTarget = useCameraA ? dynamicFocusTargetA : dynamicFocusTargetB;
|
||||||
|
|
||||||
|
nextTarget.position = currentInteractableTransform.position;
|
||||||
|
nextCam.Follow = currentInteractableTransform;
|
||||||
|
nextCam.LookAt = nextTarget;
|
||||||
|
|
||||||
|
nextCam.Priority = activePriority;
|
||||||
|
oldCam.Priority = inactivePriority;
|
||||||
|
|
||||||
|
activeDynamicTarget = nextTarget;
|
||||||
|
useCameraA = !useCameraA;
|
||||||
|
|
||||||
|
GuardManager guard = hit.transform.GetComponent<GuardManager>();
|
||||||
|
DoorManager door = hit.transform.GetComponent<DoorManager>();
|
||||||
|
|
||||||
|
if (talkButton != null) talkButton.gameObject.SetActive(false);
|
||||||
|
if (doorButton != null) doorButton.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
if (guard != null)
|
||||||
|
{
|
||||||
|
TutorialManager.Instance.LogAction("TAP");
|
||||||
|
currentGuardManager = guard;
|
||||||
|
if (talkButton != null) talkButton.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
else if (door != null)
|
||||||
|
{
|
||||||
|
TutorialManager.Instance.LogAction("TAP");
|
||||||
|
currentDoorManager = door;
|
||||||
|
if (doorButton != null) doorButton.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReturnToMainCamera();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTalkButtonClicked()
|
||||||
|
{
|
||||||
|
if (currentGuardManager != null)
|
||||||
|
{
|
||||||
|
DialogManager.Instance.StartDialog(currentGuardManager);
|
||||||
|
talkButton.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDoorButtonClicked()
|
||||||
|
{
|
||||||
|
if (currentDoorManager != null && currentDoorManager.doorCamera != null && currentDoorManager.doorSplineDolly != null)
|
||||||
|
{
|
||||||
|
doorButton.gameObject.SetActive(false);
|
||||||
|
StartCoroutine(DoorSequenceRoutine(currentDoorManager));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("The DoorManager is missing its Camera or Spline Dolly references!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReturnToMainCamera()
|
||||||
|
{
|
||||||
|
focusCameraA.Priority = inactivePriority;
|
||||||
|
focusCameraB.Priority = inactivePriority;
|
||||||
|
if (introCamera != null) introCamera.Priority = inactivePriority;
|
||||||
|
|
||||||
|
focusCameraA.Follow = null; focusCameraA.LookAt = null;
|
||||||
|
focusCameraB.Follow = null; focusCameraB.LookAt = null;
|
||||||
|
|
||||||
|
currentInteractableTransform = null;
|
||||||
|
activeDynamicTarget = null;
|
||||||
|
currentGuardManager = null;
|
||||||
|
currentDoorManager = null;
|
||||||
|
|
||||||
|
if (talkButton != null) talkButton.gameObject.SetActive(false);
|
||||||
|
if (doorButton != null) doorButton.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResetCameraPositions()
|
||||||
|
{
|
||||||
|
ReturnToMainCamera();
|
||||||
|
|
||||||
|
currentFocusOffsetX = 0f;
|
||||||
|
currentYaw = 0f;
|
||||||
|
|
||||||
|
if (explorationCamera != null)
|
||||||
|
{
|
||||||
|
explorationCamera.transform.rotation = startingRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user