]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Maus/MousePos.cs
ecbb065da8951785b9cbf084cb217151d140df08
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Maus / MousePos.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.SceneManagement;
5
6 public class MousePos : MonoBehaviour
7 {
8     private CheckpointManager checkpointManager;
9
10     Abyss abyss;
11
12     Health health;
13
14     // Start is called before the first frame update
15     void Start()
16     {
17         checkpointManager = GameObject.FindGameObjectWithTag("CheckpointManager").GetComponent<CheckpointManager>();
18         abyss = GetComponent<Abyss>();
19         health = GetComponent<Health>();
20         transform.position = checkpointManager.lastCheckpointPos;
21     }
22
23     void Update()
24     {
25         if(abyss.fallenDown || health.mouseHealth <= 0)
26         {
27             SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
28         }
29     }
30 }