Browse Source

Added timeout slider to choose dialog

master
chrisgregan 10 years ago
parent
commit
470050417e
  1. 19
      Assets/Fungus/Dialog/Scripts/ChooseDialog.cs
  2. BIN
      Assets/Shuttle/ShuttleGame.unity

19
Assets/Fungus/Dialog/Scripts/ChooseDialog.cs

@ -9,6 +9,8 @@ namespace Fungus.Script
public class ChooseDialog : Dialog
{
public Slider slider;
public class Option
{
public string text;
@ -38,8 +40,21 @@ namespace Fungus.Script
IEnumerator WaitForTimeout(float timeoutDuration, Action onTimeout)
{
yield return new WaitForSeconds(timeoutDuration);
float elapsedTime = 0;
while (elapsedTime < timeoutDuration)
{
if (slider != null)
{
float t = elapsedTime / timeoutDuration;
slider.value = t;
}
elapsedTime += Time.deltaTime;
yield return null;
}
Clear();
if (onTimeout != null)

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save