timer death

This commit is contained in:
cemt1363
2026-06-07 09:54:33 +02:00
parent fefe7ea97a
commit be72837ff0
6 changed files with 27 additions and 15 deletions
+8 -2
View File
@@ -119,6 +119,11 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &118794739 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2141180002423843430, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
m_PrefabInstance: {fileID: 1445156949}
m_PrefabAsset: {fileID: 0}
--- !u!1 &505713147 --- !u!1 &505713147
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1824,8 +1829,9 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Timer m_EditorClassIdentifier: Assembly-CSharp::Timer
timeText: {fileID: 2009337314} timeText: {fileID: 2009337314}
timeRemaining: 89 timeRemaining: 10
targetObject: {fileID: 0} targetObject: {fileID: 118794739}
damageHandler: {fileID: 0}
--- !u!114 &2112957321 --- !u!114 &2112957321
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+2 -2
View File
@@ -552,8 +552,8 @@ Transform:
m_GameObject: {fileID: 596651170} m_GameObject: {fileID: 596651170}
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, y: 0, z: 0} m_LocalPosition: {x: -0.0115, y: -0.023, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.9196271, y: 0.9231282, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
+3 -3
View File
@@ -517,7 +517,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!212 &1431685197 --- !u!212 &1431685197
SpriteRenderer: SpriteRenderer:
serializedVersion: 2 serializedVersion: 2
@@ -586,8 +586,8 @@ Transform:
m_GameObject: {fileID: 1431685196} m_GameObject: {fileID: 1431685196}
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, y: 0, z: 0} m_LocalPosition: {x: -0.0115, y: -0.0346, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.9219821, y: 0.9252364, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
+6 -4
View File
@@ -146,7 +146,7 @@ public class DamageHandler : MonoBehaviour
isDead = true; isDead = true;
TreeSpawner.treeCount = 0; TreeSpawner.treeCount = 0;
if(reason == "hole") if (reason == "hole")
{ {
SceneManager.LoadScene(2, LoadSceneMode.Single); SceneManager.LoadScene(2, LoadSceneMode.Single);
Debug.Log("Died from hole"); Debug.Log("Died from hole");
@@ -154,8 +154,10 @@ public class DamageHandler : MonoBehaviour
{ {
Debug.Log("Fell too much"); Debug.Log("Fell too much");
SceneManager.LoadScene(3, LoadSceneMode.Single); SceneManager.LoadScene(3, LoadSceneMode.Single);
Destroy(gameObject); } else if (reason == "Timer")
{
SceneManager.LoadScene(3,LoadSceneMode.Single);
} }
} Destroy(gameObject);
}
} }
-2
View File
@@ -12,8 +12,6 @@ public class DropletMovement : MonoBehaviour
private bool isGrounded = false; private bool isGrounded = false;
private float facingDirection = 1f; private float facingDirection = 1f;
private bool isDropping = false; private bool isDropping = false;
private float fallTimer;
private bool isFalling;
public float maxFallTime = 0.5f; public float maxFallTime = 0.5f;
// movement // movement
+8 -2
View File
@@ -11,6 +11,12 @@ public class Timer : MonoBehaviour
private bool timerIsRunning = false; private bool timerIsRunning = false;
public GameObject targetObject; public GameObject targetObject;
public DamageHandler damageHandler;
private void Start()
{
damageHandler = targetObject.GetComponent<DamageHandler>();
}
void Update() void Update()
{ {
@@ -51,8 +57,8 @@ public class Timer : MonoBehaviour
if (timeRemaining <= 0) if (timeRemaining <= 0)
{ {
SceneManager.LoadScene(4, LoadSceneMode.Single); //SceneManager.LoadScene(3, LoadSceneMode.Single);
Destroy(targetObject); damageHandler.Die("Timer");
} }
} }