LevelData

This commit is contained in:
2023-06-16 09:51:16 +03:00
parent 36f90ddd64
commit d9fbd99072
7 changed files with 100 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
using System;
using UnityEngine;
using Level;
public enum GameState
{
@@ -19,6 +20,9 @@ public class GameManager : MonoBehaviour
// Public
public GameState currentState { get; private set; } = GameState.Editing;
// Private
private LevelData currentLevelData;
// Properties
public static GameManager Instance => instance;
@@ -38,6 +42,7 @@ public class GameManager : MonoBehaviour
// Used by button OnClick
public void SetPlayState()
{
currentLevelData = LevelBuilder.Instance.CreateLevelData();
SetState(GameState.Gameplay);
}
@@ -45,11 +50,12 @@ public class GameManager : MonoBehaviour
// Use by button OnClick
public void SetEditState()
{
LevelBuilder.Instance.LoadLevelData(currentLevelData);
SetState(GameState.Editing);
}
public void SetState(GameState newState)
private void SetState(GameState newState)
{
currentState = newState;