death door for real for real

death door for real for real
This commit is contained in:
Thomas wilkins
2026-08-29 21:46:01 +01:00
parent 8a591a557f
commit c45abe0312
5 changed files with 330 additions and 1127 deletions
+295 -5
View File
@@ -381,7 +381,7 @@ Transform:
m_GameObject: {fileID: 2658980241334070197}
serializedVersion: 2
m_LocalRotation: {x: 0.07358181, y: 0.06576601, z: -0.0048629786, w: 0.99510646}
m_LocalPosition: {x: 0.020576129, y: 0.55308634, z: -10.600001}
m_LocalPosition: {x: -0.0004238705, y: 0.49908632, z: -11.980001}
m_LocalScale: {x: 0.41152364, y: 0.2469134, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -445,7 +445,7 @@ MonoBehaviour:
m_SplineSettings:
Spline: {fileID: 8692689237725241462}
Position: 0
Units: 1
Units: 0
SplineOffset: {x: 0, y: 0, z: 0}
CameraRotation: 0
Damping:
@@ -672,6 +672,8 @@ Transform:
m_LocalScale: {x: 2.43, y: 4.05, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6117149763702216835}
- {fileID: 6093845924917633639}
- {fileID: 8837663364318141596}
- {fileID: 5450540301096024125}
- {fileID: 34709828658865169}
@@ -720,6 +722,8 @@ MonoBehaviour:
isfocussed: 0
doorCamera: {fileID: 1305966551938095645}
doorSplineDolly: {fileID: 4016467311621144490}
deathCamera: {fileID: 4147072679059321243}
deathSplineDolly: {fileID: 5928936601894226790}
--- !u!1 &5594795846395120415
GameObject:
m_ObjectHideFlags: 0
@@ -747,7 +751,7 @@ Transform:
m_GameObject: {fileID: 5594795846395120415}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.021, y: 0.554, z: -9.62}
m_LocalPosition: {x: 0, y: 0.5, z: -11}
m_LocalScale: {x: 0.4115226, y: 0.24691355, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -818,9 +822,9 @@ MonoBehaviour:
z: 0
w: 1
m_MetaData:
- Mode: 4
- Mode: 1
Tension: 0.5
- Mode: 4
- Mode: 1
Tension: 0.5
m_Closed: 0
m_IntData:
@@ -959,6 +963,292 @@ MeshCollider:
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &6734406996691699006
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6117149763702216835}
- component: {fileID: 4147072679059321243}
- component: {fileID: 5928936601894226790}
- component: {fileID: 6957131122331096646}
m_Layer: 0
m_Name: DeathCam
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6117149763702216835
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6734406996691699006}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.49999997, z: -11}
m_LocalScale: {x: 0.4115226, y: 0.24691445, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6261725771962263685}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4147072679059321243
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6734406996691699006}
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 &5928936601894226790
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6734406996691699006}
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: 8917792220098837133}
Position: 0
Units: 0
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 &6957131122331096646
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6734406996691699006}
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 &6842213412367708379
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6093845924917633639}
- component: {fileID: 8917792220098837133}
- component: {fileID: 5401968211378067476}
m_Layer: 0
m_Name: Death Dolly Spline
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6093845924917633639
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6842213412367708379}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.5, z: -11}
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 &8917792220098837133
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6842213412367708379}
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.0008891812
y: -0.011103803
z: 0.000025192196
w: 0.999938
- Position:
x: -0.17
y: -0.015000105
z: 18.89
TangentIn:
x: 0
y: 0
z: 0
TangentOut:
x: 0
y: 0
z: 0
Rotation:
value:
x: 0.0008894407
y: -0.011103782
z: 0.0000018435329
w: 0.999938
- Position:
x: -0.25103
y: -257.7437
z: 9.09
TangentIn:
x: 0
y: 0
z: 0
TangentOut:
x: 0
y: 0
z: 0
Rotation:
value:
x: 0.0008893516
y: -0.011103789
z: 0.0000098757855
w: 0.99993795
m_MetaData:
- Mode: 1
Tension: 0.5
- Mode: 1
Tension: 0.5
- Mode: 1
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 &5401968211378067476
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6842213412367708379}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c5342500578afb24a9b83d6343d32a0f, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineSplineSmoother
AutoSmooth: 0
--- !u!1 &6864457669719155849
GameObject:
m_ObjectHideFlags: 0
File diff suppressed because it is too large Load Diff
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 43b0e5e5fb448dd5f9178e6fc2a66752
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+3 -3
View File
@@ -5715,11 +5715,11 @@ MonoBehaviour:
TangentIn:
x: 0
y: 0
z: -0.55701405
z: 0
TangentOut:
x: 0
y: 0
z: 0.55701405
z: 0
Rotation:
value:
x: -0.19298117
@@ -5729,7 +5729,7 @@ MonoBehaviour:
m_MetaData:
- Mode: 1
Tension: 0.5
- Mode: 2
- Mode: 1
Tension: 0.5
m_Closed: 0
m_IntData:
+32 -18
View File
@@ -172,54 +172,68 @@ public class CameraController : MonoBehaviour
{
isSequencePlaying = true;
RemoveHighlight();
// 1. TRIPWIRE: Check if the slots are empty!
if (activeDoor.type == "DEATH")
{
if (activeDoor.deathCamera == null) Debug.LogError("🚨 ERROR: This is a DEATH door, but the Death Camera slot is empty in the Prefab Inspector!");
if (activeDoor.deathSplineDolly == null) Debug.LogError("🚨 ERROR: This is a DEATH door, but the Death Spline Dolly slot is empty in the Prefab Inspector!");
}
// 1. Determine which camera and track to use based on the door type
bool isDeathDoor = activeDoor.type == "DEATH" && activeDoor.deathCamera != null;
// 2. Determine which camera to use
bool isDeathDoor = activeDoor.type == "DEATH" && activeDoor.deathCamera != null && activeDoor.deathSplineDolly != null;
CinemachineCamera activeCam = isDeathDoor ? activeDoor.deathCamera : activeDoor.doorCamera;
CinemachineSplineDolly activeDolly = isDeathDoor ? activeDoor.deathSplineDolly : activeDoor.doorSplineDolly;
// 2. Reset the chosen track and boost its priority
// 3. TRIPWIRE: Tell us which camera was actually chosen
Debug.Log($"🎯 Door clicked! Type is: '{activeDoor.type}'. Script is using track: '{activeCam.gameObject.name}'");
activeDolly.CameraPosition = 0f;
activeCam.Priority = 30;
yield return new WaitForSeconds(0.5f);
// 3. Push the camera (You might want to speed this up for the death drop!)
float pushSpeed = 0.5f;
// --- DISTANCE MOVEMENT FIX ---
// Using real metres now! 5f means 5 metres per second. Adjust this if it falls too slowly!
float pushSpeed = 5f;
float previousPosition = -1f;
while (activeDoor != null && activeDolly != null && activeDolly.CameraPosition < 1f)
while (activeDoor != null && activeDolly != null && activeDolly.CameraPosition > previousPosition)
{
previousPosition = activeDolly.CameraPosition;
activeDolly.CameraPosition += pushSpeed * Time.deltaTime;
yield return null;
}
// ------------------------------
string doorType = activeDoor != null ? activeDoor.type : "";
// 4. Safely drop the camera's priority
if (activeCam != null)
{
activeCam.Priority = inactivePriority;
}
// 5. Trigger the appropriate level logic
// --- PRIORITY FIX ---
if (doorType == "LIFE")
{
// Drop priority ONLY for the safe door, so the Intro Sequence can take over
if (activeCam != null) activeCam.Priority = inactivePriority;
Debug.Log("Safe door chosen! Advancing to the next level.");
GlobalStateManager.Instance.SetLevelCompleted();
yield return StartCoroutine(IntroSequenceRoutine());
}
else if (doorType == "DEATH")
{
Debug.Log("Wrong door! Teleporting back to start.");
// Insert your death/teleport logic here
Debug.Log("Wrong door! Player died.");
// We intentionally DO NOT drop the priority here.
// The camera stays locked at Priority 30, trapping the player's view at the bottom of the pit!
isSequencePlaying = false;
}
else
{
if (activeCam != null) activeCam.Priority = inactivePriority;
Debug.LogWarning($"Door type '{doorType}' is not recognised.");
isSequencePlaying = false;
ReturnToMainCamera();
}
// 6. Play the intro sweep for the newly generated room or restart
yield return StartCoroutine(IntroSequenceRoutine());
}
    private void HandleEdgeNudge()