48 lines
750 B
C#
48 lines
750 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class MicroGameHandler : MonoBehaviour
|
|
{
|
|
public float timeLimit;
|
|
private float currentTime;
|
|
public int score;
|
|
public int minimumScore;
|
|
public bool loseOnTimeLimit;
|
|
|
|
private void Start()
|
|
{
|
|
StartGame();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
currentTime -= Time.deltaTime;
|
|
if (currentTime < 0)
|
|
{
|
|
TimeOut();
|
|
}
|
|
}
|
|
|
|
private void TimeOut()
|
|
{
|
|
if (loseOnTimeLimit || (minimumScore > 0 && score < minimumScore))
|
|
{
|
|
FailGame();
|
|
}
|
|
}
|
|
|
|
public void FailGame()
|
|
{
|
|
|
|
}
|
|
|
|
public void WinGame()
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void StartGame()
|
|
{
|
|
|
|
}
|
|
}
|