mirror of
https://github.com/ConjureETS/OuijaMTLGJ2016.git
synced 2026-03-24 02:01:06 +00:00
make the menu screen skippable after certain time
This commit is contained in:
parent
f092ab1aa4
commit
7ba3cdd21f
@ -4,9 +4,10 @@ using System.Collections;
|
|||||||
public class MenuInteractions : MonoBehaviour
|
public class MenuInteractions : MonoBehaviour
|
||||||
{
|
{
|
||||||
public int nextLevel;
|
public int nextLevel;
|
||||||
public bool isSkippable = true;
|
|
||||||
public bool hasAutoSkips = false;
|
public bool hasAutoSkips = false;
|
||||||
public int timeBeforeSkip = 10;
|
public int timeBeforeAutoSkip = 10;
|
||||||
|
public int timeBeforeSkippable = 0;
|
||||||
|
private bool isSkippable = false;
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
@ -18,16 +19,13 @@ public class MenuInteractions : MonoBehaviour
|
|||||||
Application.LoadLevel(nextLevel);
|
Application.LoadLevel(nextLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
// this won't lead anywhere... let's fix it
|
|
||||||
if(!isSkippable && !hasAutoSkips)
|
StartCoroutine(EnableSkip());
|
||||||
{
|
|
||||||
isSkippable = true;
|
|
||||||
hasAutoSkips = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasAutoSkips)
|
if (hasAutoSkips)
|
||||||
{
|
{
|
||||||
@ -37,8 +35,15 @@ public class MenuInteractions : MonoBehaviour
|
|||||||
|
|
||||||
IEnumerator AutoSkip()
|
IEnumerator AutoSkip()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(timeBeforeSkip);
|
yield return new WaitForSeconds(timeBeforeAutoSkip);
|
||||||
Application.LoadLevel(nextLevel);
|
Application.LoadLevel(nextLevel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerator EnableSkip()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(timeBeforeSkippable);
|
||||||
|
isSkippable = true;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user