using System; using UnityEngine; public class Level : MonoBehaviour { public event Action OnEnded; public bool IsEnded { get; private set; } public void Init() { } public void Play() { IsEnded = false; } private void Update() { if(Input.GetKeyDown(KeyCode.Space)) Victory(); } public void Lose() { if(IsEnded) return; EndLevel(EnumLevelResult.FAIL); } public void Victory() { if(IsEnded) return; EndLevel(EnumLevelResult.WIN); } private void EndLevel(EnumLevelResult result) { IsEnded = true; OnEnded?.Invoke(result); } public Transform GetPlayerTransform() { throw new NotImplementedException(); } }