hellbound/Assets/Scripts/Game/Level/Level.cs

52 lines
832 B
C#
Raw Normal View History

2021-11-26 11:16:25 +03:00
using System;
using UnityEngine;
public class Level : MonoBehaviour
{
public event Action<EnumLevelResult> 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();
}
}