]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Maus/CheckpointManager.cs
Checkpoint-Soundeffekt
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Maus / CheckpointManager.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4
5 public class CheckpointManager : MonoBehaviour
6 {
7     private static CheckpointManager instance;
8
9     public Vector3 lastCheckpointPos;
10
11     Cheese cheese;
12
13     CheeseCoin cheeseCoin;
14
15     public Transform mouse;
16
17     public int lastCheeseCount;
18
19     public bool isCheeseCoinCollected;
20
21
22     void Awake()
23     {
24         if (instance == null)
25         {
26             instance = this;
27             DontDestroyOnLoad(instance);
28         }
29         else
30         {
31             Destroy(gameObject);
32         }
33     }
34     //cheese muss noch definiert werden
35
36
37     public void SavePlayer ()
38     {
39         SaveSystem.SavePlayer(instance, cheese, cheeseCoin);
40     }
41
42     public void LoadPlayer()
43     {
44         PlayerData data = SaveSystem.LoadPlayer();
45
46         cheese.cheesecount = data.collectedCheese;
47         cheeseCoin.cheeseCoinCollected = data.isCheeseCoinCollected;
48
49         Vector3 position;
50         position.x = data.position[0];
51         position.y = data.position[1];
52         position.z = data.position[2];
53         mouse.transform.position = position;
54     }
55 }