]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Mouse/MousePos.cs
coyote time
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Mouse / 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     private Cheese cheese;
11
12     Abyss abyss;
13
14     Health health;
15
16     // Start is called before the first frame update
17     void Start()
18     {
19         checkpointManager = GameObject.FindGameObjectWithTag("CheckpointManager").GetComponent<CheckpointManager>();
20         abyss = GetComponent<Abyss>();
21         health = GetComponent<Health>();
22         cheese = GetComponent<Cheese>();
23         transform.position = checkpointManager.lastCheckpointPos;
24         cheese.cheesecount = checkpointManager.lastCheeseCount;
25     }
26
27     void Update()
28     {
29         if(abyss.fallenDown || health.mouseHealth <= 0)
30         {
31             SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
32         }
33     }
34 }