deaths door
This commit is contained in:
@@ -140,6 +140,152 @@ MonoBehaviour:
|
||||
Time: 0
|
||||
Smoothing: 0
|
||||
IgnoreY: 0
|
||||
--- !u!1 &171430610746948940
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8486146361536531750}
|
||||
- component: {fileID: 8460338616522548121}
|
||||
- component: {fileID: 5622283389732489967}
|
||||
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 &8486146361536531750
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 171430610746948940}
|
||||
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 &8460338616522548121
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 171430610746948940}
|
||||
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: -1.6045649
|
||||
TangentOut:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 1.6045649
|
||||
Rotation:
|
||||
value:
|
||||
x: 0.0008891812
|
||||
y: -0.011103801
|
||||
z: 0.000025192192
|
||||
w: 0.999938
|
||||
- Position:
|
||||
x: -0.17103
|
||||
y: -0.013700247
|
||||
z: 7.7
|
||||
TangentIn:
|
||||
x: 0
|
||||
y: 0
|
||||
z: -1.2836514
|
||||
TangentOut:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 1.2836514
|
||||
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: 2
|
||||
Tension: 0.5
|
||||
- Mode: 2
|
||||
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 &5622283389732489967
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 171430610746948940}
|
||||
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 &1857798259198218514
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -554,6 +700,8 @@ Transform:
|
||||
- {fileID: 34709828658865169}
|
||||
- {fileID: 7948981819171241343}
|
||||
- {fileID: 912666790872368808}
|
||||
- {fileID: 5763264831821740971}
|
||||
- {fileID: 8486146361536531750}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &7866095202227853034
|
||||
@@ -596,6 +744,148 @@ MonoBehaviour:
|
||||
isfocussed: 0
|
||||
doorCamera: {fileID: 3247703817837353023}
|
||||
doorSplineDolly: {fileID: 3385227337432197715}
|
||||
deathCamera: {fileID: 2529712832601522221}
|
||||
deathSplineDolly: {fileID: 5276452210671894326}
|
||||
--- !u!1 &6648741166833317941
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5763264831821740971}
|
||||
- component: {fileID: 2529712832601522221}
|
||||
- component: {fileID: 5276452210671894326}
|
||||
- component: {fileID: 346132022937810732}
|
||||
m_Layer: 0
|
||||
m_Name: DeathCam
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5763264831821740971
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6648741166833317941}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.18944009, y: 0.64427394, z: -0.16919321, w: 0.72138566}
|
||||
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 &2529712832601522221
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6648741166833317941}
|
||||
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!114 &5276452210671894326
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6648741166833317941}
|
||||
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: 8460338616522548121}
|
||||
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 &346132022937810732
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6648741166833317941}
|
||||
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 &8392774035223462151
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -169,52 +169,58 @@ public class CameraController : MonoBehaviour
|
||||
}
|
||||
|
||||
private IEnumerator DoorSequenceRoutine(DoorManager activeDoor)
|
||||
{
|
||||
isSequencePlaying = true;
|
||||
RemoveHighlight();
|
||||
|
||||
activeDoor.doorSplineDolly.CameraPosition = 0f;
|
||||
activeDoor.doorCamera.Priority = 30;
|
||||
{
|
||||
isSequencePlaying = true;
|
||||
RemoveHighlight();
|
||||
|
||||
// 1. Determine which camera and track to use based on the door type
|
||||
bool isDeathDoor = activeDoor.type == "DEATH" && activeDoor.deathCamera != null;
|
||||
|
||||
CinemachineCamera activeCam = isDeathDoor ? activeDoor.deathCamera : activeDoor.doorCamera;
|
||||
CinemachineSplineDolly activeDolly = isDeathDoor ? activeDoor.deathSplineDolly : activeDoor.doorSplineDolly;
|
||||
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
// 2. Reset the chosen track and boost its priority
|
||||
activeDolly.CameraPosition = 0f;
|
||||
activeCam.Priority = 30;
|
||||
|
||||
float pushSpeed = 0.5f;
|
||||
|
||||
// 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;
|
||||
}
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
// Cache the type just in case the door is destroyed during level generation
|
||||
string doorType = activeDoor != null ? activeDoor.type : "";
|
||||
// 3. Push the camera (You might want to speed this up for the death drop!)
|
||||
float pushSpeed = 0.5f;
|
||||
|
||||
while (activeDoor != null && activeDolly != null && activeDolly.CameraPosition < 1f)
|
||||
{
|
||||
activeDolly.CameraPosition += pushSpeed * Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// Drop the door camera's priority BEFORE we update the level
|
||||
if (activeDoor != null && activeDoor.doorCamera != null)
|
||||
{
|
||||
activeDoor.doorCamera.Priority = inactivePriority;
|
||||
}
|
||||
string doorType = activeDoor != null ? activeDoor.type : "";
|
||||
|
||||
// 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.");
|
||||
}
|
||||
// 4. Safely drop the camera's priority
|
||||
if (activeCam != null)
|
||||
{
|
||||
activeCam.Priority = inactivePriority;
|
||||
}
|
||||
|
||||
// Play the intro sequence for the newly generated room
|
||||
yield return StartCoroutine(IntroSequenceRoutine());
|
||||
}
|
||||
// 5. Trigger the appropriate level 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.");
|
||||
// Insert your death/teleport logic here
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"Door type '{doorType}' is not recognised.");
|
||||
}
|
||||
|
||||
// 6. Play the intro sweep for the newly generated room or restart
|
||||
yield return StartCoroutine(IntroSequenceRoutine());
|
||||
}
|
||||
|
||||
private void HandleEdgeNudge()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,9 @@ public class DoorManager : MonoBehaviour, IDescribable
|
||||
|
||||
public CinemachineCamera doorCamera;
|
||||
public CinemachineSplineDolly doorSplineDolly;
|
||||
|
||||
public CinemachineCamera deathCamera;
|
||||
public CinemachineSplineDolly deathSplineDolly;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
|
||||
Reference in New Issue
Block a user