mirror of
https://github.com/ConjureETS/OuijaMTLGJ2016.git
synced 2026-03-24 10:11:07 +00:00
45 lines
909 B
C#
45 lines
909 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class MenuInteractions : MonoBehaviour
|
|
{
|
|
public int nextLevel;
|
|
public bool isSkippable = true;
|
|
public bool hasAutoSkips = false;
|
|
public int timeBeforeSkip = 10;
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (isSkippable)
|
|
{
|
|
if (Input.anyKeyDown)
|
|
{
|
|
Application.LoadLevel(nextLevel);
|
|
}
|
|
}
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
// this won't lead anywhere... let's fix it
|
|
if(!isSkippable && !hasAutoSkips)
|
|
{
|
|
isSkippable = true;
|
|
hasAutoSkips = true;
|
|
}
|
|
|
|
if (hasAutoSkips)
|
|
{
|
|
StartCoroutine(AutoSkip());
|
|
}
|
|
}
|
|
|
|
IEnumerator AutoSkip()
|
|
{
|
|
yield return new WaitForSeconds(timeBeforeSkip);
|
|
Application.LoadLevel(nextLevel);
|
|
|
|
}
|
|
}
|