Done?
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Level;
|
||||
using Objects;
|
||||
|
||||
public enum GameState
|
||||
{
|
||||
@@ -21,6 +22,7 @@ public class GameManager : MonoBehaviour
|
||||
public GameState currentState { get; private set; } = GameState.Editing;
|
||||
|
||||
// Private
|
||||
[SerializeField] private GameplayUI gameplayUI;
|
||||
private LevelData currentLevelData;
|
||||
|
||||
// Properties
|
||||
@@ -35,10 +37,17 @@ public class GameManager : MonoBehaviour
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Player.Instance.PlayerMoved += CheckWin;
|
||||
}
|
||||
|
||||
|
||||
// Used by button OnClick
|
||||
public void SetPlayState()
|
||||
{
|
||||
@@ -61,4 +70,13 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
GameStateChanged?.Invoke(currentState);
|
||||
}
|
||||
|
||||
|
||||
private void CheckWin()
|
||||
{
|
||||
if (!LevelBuilder.Instance.UnoccupiedTargetExists())
|
||||
{
|
||||
gameplayUI.ShowWinScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user