start work on microgames
This commit is contained in:
parent
ef733054ef
commit
ecff3c6b69
6 changed files with 105 additions and 0 deletions
37
Assets/Scripts/Microgame/MicroGameHandler.cs
Normal file
37
Assets/Scripts/Microgame/MicroGameHandler.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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 Update()
|
||||
{
|
||||
currentTime -= Time.deltaTime;
|
||||
if (currentTime < 0)
|
||||
{
|
||||
TimeOut();
|
||||
}
|
||||
}
|
||||
|
||||
private void TimeOut()
|
||||
{
|
||||
if (loseOnTimeLimit || (minimumScore > 0 && score < minimumScore))
|
||||
{
|
||||
FailGame();
|
||||
}
|
||||
}
|
||||
|
||||
public void FailGame()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void WinGame()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue