Exemplo n.º 1
0
    //CUTSCENES

    public void CutsceneStart(SOCutscene cutscene)
    {
        InventoryToolbar.SetActive(false);
        CurrentCutscene = cutscene;
        StartCoroutine(QueueCutscene(cutscene));
        UpdateState();
    }
Exemplo n.º 2
0
    private IEnumerator QueueCutscene(SOCutscene cutscene)
    {
        foreach (CutsceneEntry entry in cutscene.Entries)
        {
            float entryDuration = entry.AudioClip ? entry.AudioClip.length + entry.ExtraDuration : entry.ExtraDuration;
            CutsceneSetDialog(entry);
            if (entry.Callback != null)
            {
                entry.Callback.Invoke();
            }
            // Manually wait for entryDuration seconds to support cancelling
            float remainingTimeDuration = entryDuration;
            while (remainingTimeDuration > 0)
            {
                remainingTimeDuration -= Time.deltaTime;
                if (Input.GetMouseButtonUp(0))
                {
                    if (entryDuration - remainingTimeDuration > 0.15)
                    {
                        GetComponent <AudioSource>().Stop();
                        break;
                    }
                    else
                    {
                        //GameController.Log("Can't skip yet", entryDuration, remainingTimeDuration);
                    }
                }
                // Yield to return out of the Ienumeration
                yield return(0);
            }
            // Always clear up and hide dialog
            if (cutscene.SwitchToSet)
            {
                GameController.Instance.SetSwitch(cutscene.SwitchToSet);
            }

            if (cutscene.SwitchToClear)
            {
                GameController.Instance.ClearSwitch(cutscene.SwitchToClear);
            }

            if (cutscene.ItemToGet)
            {
                GameUIController.Instance.InventoryAddItem(cutscene.ItemToGet);
            }

            CutsceneClearDialog();
            DialogToolbar.SetActive(false);
        }
        CutsceneEndCurrent();
        if (cutscene.DialogTree)
        {
            DialogTreeDisplay(cutscene.DialogTree);
        }
        yield break;
    }
Exemplo n.º 3
0
 public void StartCutscene(SOCutscene cutscene)
 {
     GameUIController.Instance.CutsceneStart(cutscene);
 }
Exemplo n.º 4
0
 public void StartCutscene(string cutsceneName)
 {
     GameUIController.Instance.CutsceneStart(SOCutscene.Load(cutsceneName));
 }
Exemplo n.º 5
0
 private void CutsceneEndCurrent()
 {
     CurrentCutscene = null;
     UpdateState();
 }