Refactored SaveSystem & Endlevel, renamed animations

The SaveSystem can now create a save file if it doesn't exist already.
And other changes
This commit is contained in:
MarcUs7 2024-10-05 19:53:32 +02:00
parent 3145dbf93e
commit 7fd4e011a2
7 changed files with 23 additions and 22 deletions

View file

@ -8,14 +8,12 @@ public class Endlevel : MonoBehaviour
public SceneFader sceneFader;
public static int level = 0;
private int SetLevel;
public static bool nextLevel = false;
void Awake()
{
//Make Collider2D as trigger
GetComponent<Collider2D>().isTrigger = true;
level = PlayerSaving.level;
Debug.Log(level);
SetLevel = GetValueForSetLevel();
}
@ -23,9 +21,7 @@ public class Endlevel : MonoBehaviour
{
if (c2d.CompareTag("Player"))
{
level = SetLevel;
Debug.Log(level);
sceneFader.FadeTo(levelToLoad);
GoToNextLevel();
}
}
@ -40,14 +36,13 @@ public class Endlevel : MonoBehaviour
//Debug.Log("Saved " + PlayerSaving.levels + " Level");
}
}
}
if (nextLevel)
{
nextLevel = false;
level = SetLevel;
Debug.Log(level);
sceneFader.FadeTo(levelToLoad);
}
public void GoToNextLevel()
{
level = SetLevel;
Debug.Log(level);
sceneFader.FadeTo(levelToLoad);
}
public int GetValueForSetLevel()