Merge branch 'master' of github.com:WillJeynes/Brackeys2026-2
This commit is contained in:
@@ -1,5 +1,271 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &107722067803123281
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7948981819171241343}
|
||||
- component: {fileID: 3247703817837353023}
|
||||
- component: {fileID: 3385227337432197715}
|
||||
- component: {fileID: 2376594272072735747}
|
||||
m_Layer: 0
|
||||
m_Name: CinemachineCamera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7948981819171241343
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 107722067803123281}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.073581405, y: 0.06576645, z: -0.004868995, w: 0.99510646}
|
||||
m_LocalPosition: {x: 0.021, y: 0.554, z: -5.19}
|
||||
m_LocalScale: {x: 0.4115226, y: 0.24691355, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6261725771962263685}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3247703817837353023
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 107722067803123281}
|
||||
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: 1
|
||||
m_Value: 10
|
||||
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!114 &3385227337432197715
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 107722067803123281}
|
||||
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: 352144824822894997}
|
||||
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 &2376594272072735747
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 107722067803123281}
|
||||
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!1 &1857798259198218514
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 912666790872368808}
|
||||
- component: {fileID: 352144824822894997}
|
||||
- component: {fileID: 7383125720942452953}
|
||||
m_Layer: 0
|
||||
m_Name: Dolly Spline
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &912666790872368808
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1857798259198218514}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0.021, y: 0.554, z: -5.19}
|
||||
m_LocalScale: {x: 0.4115226, y: 0.24691355, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6261725771962263685}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &352144824822894997
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1857798259198218514}
|
||||
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
|
||||
TangentIn:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
TangentOut:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
Rotation:
|
||||
value:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
w: 1
|
||||
- Position:
|
||||
x: -0.19103001
|
||||
y: -0.0037002563
|
||||
z: 10.25
|
||||
TangentIn:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
TangentOut:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
Rotation:
|
||||
value:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
w: 1
|
||||
m_MetaData:
|
||||
- Mode: 4
|
||||
Tension: 0.5
|
||||
- Mode: 4
|
||||
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!114 &7383125720942452953
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1857798259198218514}
|
||||
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!1 &2102034327205085668
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -286,6 +552,8 @@ Transform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 34709828658865169}
|
||||
- {fileID: 7948981819171241343}
|
||||
- {fileID: 912666790872368808}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &7866095202227853034
|
||||
@@ -325,7 +593,9 @@ MonoBehaviour:
|
||||
mod:
|
||||
blueMaterial: {fileID: 2100000, guid: d62ae3e529a14d961b7ac9b6967da04e, type: 2}
|
||||
redMaterial: {fileID: 2100000, guid: 7a46060c77bcaaf79a5c30c1f6001499, type: 2}
|
||||
focusLight: {fileID: 0}
|
||||
isfocussed: 0
|
||||
doorCamera: {fileID: 3247703817837353023}
|
||||
doorSplineDolly: {fileID: 3385227337432197715}
|
||||
--- !u!1 &8392774035223462151
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -224,7 +224,7 @@ Transform:
|
||||
m_GameObject: {fileID: 17649577}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 37.25, y: -1.21, z: -30.7}
|
||||
m_LocalPosition: {x: 25, y: 5, z: -30}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -2100,7 +2100,7 @@ Transform:
|
||||
m_GameObject: {fileID: 330585543}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 37.25, y: -1.21, z: -30.7}
|
||||
m_LocalPosition: {x: 25, y: 5, z: -30}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -4684,6 +4684,37 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 794486860}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -6557,7 +6588,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1271088886}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 37.25, y: -1.21, z: -30.7}
|
||||
m_LocalPosition: {x: 25, y: 5, z: -30}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -6883,7 +6914,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1277677654}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 37.25, y: -1.21, z: -30.7}
|
||||
m_LocalPosition: {x: 25, y: 5, z: -30}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -9158,7 +9189,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1725951279}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 50.97526, y: -0, z: 53.31606}
|
||||
m_LocalPosition: {x: 25, y: 5, z: -30}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -10396,6 +10427,37 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -10715,3 +10777,5 @@ SceneRoots:
|
||||
- {fileID: 17649579}
|
||||
- {fileID: 1277677658}
|
||||
- {fileID: 1743187106}
|
||||
- {fileID: 813747524}
|
||||
- {fileID: 2057252393}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Unity.Cinemachine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using System.Collections;
|
||||
|
||||
public class CameraController : MonoBehaviour
|
||||
{
|
||||
@@ -20,9 +21,9 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
[Header("UI Setup")]
|
||||
public Button talkButton;
|
||||
public Button doorButton; // New button for the doors
|
||||
public Button doorButton;
|
||||
private GuardManager currentGuardManager;
|
||||
private DoorManager currentDoorManager; // New reference for the door
|
||||
private DoorManager currentDoorManager;
|
||||
|
||||
[Header("Hover Highlight Settings")]
|
||||
public Color highlightColour = Color.yellow;
|
||||
@@ -38,19 +39,17 @@ public class CameraController : MonoBehaviour
|
||||
public float focusNudgeSpeed = 5f;
|
||||
public float maxFocusOffset = 2f;
|
||||
|
||||
// Exploration rotation tracker (Horizontal only now)
|
||||
private Quaternion startingRotation;
|
||||
private float currentYaw = 0f;
|
||||
|
||||
// Ping-Pong Focus Trackers
|
||||
private bool useCameraA = true;
|
||||
private Transform dynamicFocusTargetA;
|
||||
private Transform dynamicFocusTargetB;
|
||||
private Transform activeDynamicTarget;
|
||||
private Transform currentInteractableTransform;
|
||||
|
||||
// Focus offset (Horizontal only now)
|
||||
private float currentFocusOffsetX = 0f;
|
||||
private bool isSequencePlaying = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -77,7 +76,7 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Mouse.current == null) return;
|
||||
if (Mouse.current == null || isSequencePlaying) return;
|
||||
|
||||
HandleHover();
|
||||
HandleEdgeNudge();
|
||||
@@ -86,8 +85,6 @@ public class CameraController : MonoBehaviour
|
||||
{
|
||||
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
// TRIPWIRE 1: ADD THIS LINE HERE
|
||||
Debug.Log("⚠️ Click cancelled! The EventSystem thinks your mouse is hovering over a UI element.");
|
||||
return;
|
||||
}
|
||||
HandleInteractionClick();
|
||||
@@ -109,7 +106,6 @@ public class CameraController : MonoBehaviour
|
||||
Vector2 mousePos = Mouse.current.position.ReadValue();
|
||||
float yawInput = 0f;
|
||||
|
||||
// Check horizontal edges only
|
||||
if (mousePos.x < edgeThickness) yawInput = -1f;
|
||||
else if (mousePos.x > Screen.width - edgeThickness) yawInput = 1f;
|
||||
|
||||
@@ -122,7 +118,6 @@ public class CameraController : MonoBehaviour
|
||||
currentFocusOffsetX += yawInput * focusNudgeSpeed * Time.deltaTime;
|
||||
currentFocusOffsetX = Mathf.Clamp(currentFocusOffsetX, -maxFocusOffset, maxFocusOffset);
|
||||
|
||||
// Move the invisible point horizontally relative to the camera
|
||||
activeDynamicTarget.position = currentInteractableTransform.position
|
||||
+ (mainUnityCamera.transform.right * currentFocusOffsetX);
|
||||
}
|
||||
@@ -161,17 +156,6 @@ public class CameraController : MonoBehaviour
|
||||
originalColour = currentlyHoveredRenderer.material.color;
|
||||
currentlyHoveredRenderer.material.color = highlightColour;
|
||||
}
|
||||
|
||||
|
||||
if (currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>() != null)
|
||||
{
|
||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<DoorManager>().isfocussed = 1;
|
||||
}
|
||||
|
||||
if (currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>() != null)
|
||||
{
|
||||
currentlyHoveredRenderer.gameObject.GetComponentInParent<GuardManager>().isfocussed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -220,9 +204,6 @@ public class CameraController : MonoBehaviour
|
||||
|
||||
if (Physics.Raycast(ray, out RaycastHit hit, 100f, interactableLayer))
|
||||
{
|
||||
// TRIPWIRE 2: ADD THIS LINE HERE
|
||||
Debug.Log($"🎯 Raycast successfully hit: {hit.transform.name}");
|
||||
|
||||
currentInteractableTransform = hit.transform;
|
||||
currentFocusOffsetX = 0f;
|
||||
|
||||
@@ -230,13 +211,6 @@ public class CameraController : MonoBehaviour
|
||||
CinemachineCamera oldCam = useCameraA ? focusCameraB : focusCameraA;
|
||||
Transform nextTarget = useCameraA ? dynamicFocusTargetA : dynamicFocusTargetB;
|
||||
|
||||
// TRIPWIRE 3: ADD THIS SAFETY CHECK HERE
|
||||
if (nextCam == null)
|
||||
{
|
||||
Debug.LogError("🚨 ERROR: One of your Focus Cameras is missing in the GameManager Inspector!");
|
||||
return;
|
||||
}
|
||||
|
||||
nextTarget.position = currentInteractableTransform.position;
|
||||
nextCam.Follow = currentInteractableTransform;
|
||||
nextCam.LookAt = nextTarget;
|
||||
@@ -247,39 +221,26 @@ public class CameraController : MonoBehaviour
|
||||
activeDynamicTarget = nextTarget;
|
||||
useCameraA = !useCameraA;
|
||||
|
||||
// Logic to determine which UI button to show
|
||||
GuardManager guard = hit.transform.GetComponent<GuardManager>();
|
||||
DoorManager door = hit.transform.GetComponent<DoorManager>();
|
||||
|
||||
// Hide both first to be safe, then reveal the correct one
|
||||
if (talkButton != null) talkButton.gameObject.SetActive(false);
|
||||
if (doorButton != null) doorButton.gameObject.SetActive(false);
|
||||
|
||||
UnsetAll();
|
||||
currentDoorManager = null;
|
||||
currentGuardManager = null;
|
||||
|
||||
if (guard != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("WordAdd");
|
||||
currentGuardManager = guard;
|
||||
guard.isfocussed = 2;
|
||||
if (talkButton != null) talkButton.gameObject.SetActive(true);
|
||||
}
|
||||
else if (door != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("WordAdd");
|
||||
currentDoorManager = door;
|
||||
door.isfocussed = 2;
|
||||
if (doorButton != null) doorButton.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TRIPWIRE 4: ADD THIS LINE HERE
|
||||
Debug.Log("💨 Raycast hit nothing on the Interactable layer. Returning to main camera.");
|
||||
ReturnToMainCamera();
|
||||
AudioManager.Instance.PlaySound("WordRemove");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,19 +248,63 @@ public class CameraController : MonoBehaviour
|
||||
{
|
||||
if (currentGuardManager != null)
|
||||
{
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
DialogManager.Instance.StartDialog(currentGuardManager);
|
||||
//talkButton.gameObject.SetActive(false);
|
||||
talkButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDoorButtonClicked()
|
||||
{
|
||||
if (currentDoorManager != null)
|
||||
if (currentDoorManager != null && currentDoorManager.doorCamera != null && currentDoorManager.doorSplineDolly != null)
|
||||
{
|
||||
// Add your door sequence logic here!
|
||||
Debug.Log("Door sequence started!");
|
||||
//doorButton.gameObject.SetActive(false);
|
||||
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;
|
||||
RemoveHighlight();
|
||||
|
||||
activeDoor.doorSplineDolly.CameraPosition = 0f;
|
||||
activeDoor.doorCamera.Priority = 30;
|
||||
|
||||
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;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
activeDoor.doorSplineDolly.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(GlobalStateManager.Instance.LevelIntended);
|
||||
}
|
||||
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
|
||||
{
|
||||
Debug.LogWarning($"Door type '{activeDoor.type}' is not recognised for level transitions.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +321,6 @@ public class CameraController : MonoBehaviour
|
||||
currentGuardManager = null;
|
||||
currentDoorManager = null;
|
||||
|
||||
UnsetAll();
|
||||
if (talkButton != null) talkButton.gameObject.SetActive(false);
|
||||
if (doorButton != null) doorButton.gameObject.SetActive(false);
|
||||
}
|
||||
@@ -333,17 +337,4 @@ public class CameraController : MonoBehaviour
|
||||
explorationCamera.transform.rotation = startingRotation;
|
||||
}
|
||||
}
|
||||
|
||||
private void UnsetAll()
|
||||
{
|
||||
foreach (var doorManager in LevelLoader.Instance.Doors)
|
||||
{
|
||||
doorManager.isfocussed = 0;
|
||||
}
|
||||
foreach (var doorManager in LevelLoader.Instance.Guards)
|
||||
{
|
||||
doorManager.isfocussed = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,11 @@ using DefaultNamespace;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Utils;
|
||||
using UnityEngine;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class DoorManager : MonoBehaviour, IDescribable
|
||||
{
|
||||
@@ -18,6 +23,9 @@ public class DoorManager : MonoBehaviour, IDescribable
|
||||
|
||||
private LightFlickerer indicatorLight;
|
||||
|
||||
public CinemachineCamera doorCamera;
|
||||
public CinemachineSplineDolly doorSplineDolly;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user