示例#1
0
 void Show()
 {
     gameObject.SetUIAlpha(0);
     StartCoroutine(M_Math.ExecuteDelayed(m_Item.GetIndex() == 0 ? 0.5f : 4f,
                                          () => StartCoroutine(M_Extensions.YieldT((f) => { gameObject.SetUIAlpha(f); }, 0.5f))
                                          ));
 }
示例#2
0
    static GlobalUpdateDispatcher GetInstance()
    {
        if (instance == null)
        {
            instance = M_Extensions.MakeNew <GlobalUpdateDispatcher>("_GlobalUpdate");
        }

        return(instance);
    }
示例#3
0
    void OnEnable()
    {
        BackButton.interactable = false;
        ListViewEvacuated.Init(SquadManager.Instance.evacuated);
        Canvas.ForceUpdateCanvases();
        Loot.SetView(MissionOutcome.LastOutcome, 0);

        //disable delay if there are no rewards (delay is reserving time for loot view)
        M_Extensions.ExecuteDelayed(this, MissionOutcome.LastOutcome.SquadUnitsEvaced == 0 ? 0 : 5, () => Progress.SetView(MissionOutcome.LastOutcome));
        M_Extensions.ExecuteDelayed(this, MissionOutcome.LastOutcome.SquadUnitsEvaced == 0 ? 0 : 5.25f, () => { BackButton.interactable = true; });
    }
示例#4
0
    void OnStartTurn(ITurn turn)
    {
        float start = m_GrayScale.GetGray();

        if (turn.GetType() == typeof(Unit) && (turn as Unit).OwnerID == 1 && !(turn as Unit).IsIdentified)
        {
            StopAllCoroutines();
            Noise.enabled = true;
            StartCoroutine(M_Extensions.YieldT(f => m_GrayScale.SetGray(start + (1 - start) * f), 0.25f));
        }
        else
        {
            StopAllCoroutines();
            Noise.enabled = false;
            StartCoroutine(M_Extensions.YieldT(f => m_GrayScale.SetGray(start * (1 - f)), 0.25f));
        }
    }
示例#5
0
    // The coroutine runs on its own at the same time as Update() and takes an integer indicating which scene to load.
    IEnumerator LoadNewScene()
    {
        Splash.gameObject.SetActive(showsplash);
        yield return(new WaitForSeconds(0.1f));

        if (showsplash)
        {
            Loading.gameObject.SetActive(false);
            showsplash = false;
            to_load    = 1;
            yield return(StartCoroutine(M_Extensions.YieldT(f => Splash.alpha = f, 0.5f)));

            yield return(new WaitForSeconds(2f));

            yield return(StartCoroutine(M_Extensions.YieldT(f => Splash.alpha = 1 - f, 0.5f)));
        }
        else
        {
            yield return(new WaitForSeconds(0.5f));
        }

        Loading.gameObject.SetActive(true);
        Loading.alpha = 0;
        yield return(StartCoroutine(M_Extensions.YieldT(f => Loading.alpha = f, 0.25f)));

        // Start an asynchronous operation to load the scene that was passed to the LoadNewScene coroutine.
        AsyncOperation async = SceneManager.LoadSceneAsync(to_load, LoadSceneMode.Single);

        // While the asynchronous operation to load the new scene is not yet complete, continue waiting until it's done.
        while (!async.isDone)
        {
            MDebug.Log(async.progress + " " + Time.time);
            yield return(null);
        }


        yield return(StartCoroutine(M_Extensions.YieldT(f => Loading.alpha = 1 - f, 1f)));

        yield return(new WaitForSeconds(0.5f));
    }
示例#6
0
 void Removed()
 {
     StartCoroutine(M_Extensions.YieldT((f) => { gameObject.SetUIAlpha(1 - f); }, 0.5f));
     StartCoroutine(M_Math.ExecuteDelayed(0.5f, () => { OnRemoved.AttemptCall(); Destroy(this.gameObject); }));
 }
示例#7
0
    IEnumerator Fade()
    {
        yield return(new WaitForSeconds(0.3f));

        StartCoroutine(M_Extensions.YieldT(SetAlpha, 0.75f));
    }