mirror of
https://github.com/ConjureETS/OuijaMTLGJ2016.git
synced 2026-03-24 10:11:07 +00:00
50 lines
969 B
C#
50 lines
969 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class MenuInteractions : MonoBehaviour
|
|
{
|
|
public int nextLevel;
|
|
public bool hasAutoSkips = false;
|
|
public int timeBeforeAutoSkip = 10;
|
|
public int timeBeforeSkippable = 0;
|
|
private bool isSkippable = false;
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (isSkippable)
|
|
{
|
|
if (Input.anyKeyDown)
|
|
{
|
|
Application.LoadLevel(nextLevel);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
|
|
StartCoroutine(EnableSkip());
|
|
|
|
if (hasAutoSkips)
|
|
{
|
|
StartCoroutine(AutoSkip());
|
|
}
|
|
}
|
|
|
|
IEnumerator AutoSkip()
|
|
{
|
|
yield return new WaitForSeconds(timeBeforeAutoSkip);
|
|
Application.LoadLevel(nextLevel);
|
|
|
|
}
|
|
|
|
IEnumerator EnableSkip()
|
|
{
|
|
yield return new WaitForSeconds(timeBeforeSkippable);
|
|
isSkippable = true;
|
|
|
|
}
|
|
}
|