Exemple #1
0
    private IEnumerator StartLoading_2(int scene)
    {
        int            displayProgress = 0;
        int            toProgress      = 0;
        AsyncOperation op = SceneManager.LoadSceneAsync(scene);

        op.allowSceneActivation = false;
        while (op.progress < 0.9f)
        {
            toProgress = (int)op.progress * 100;
            while (displayProgress < toProgress)
            {
                ++displayProgress;
                SetLoadingPercentage(displayProgress);
                yield return(new WaitForEndOfFrame());
            }
        }
        toProgress = 100;
        while (displayProgress < toProgress)
        {
            ++displayProgress;
            SetLoadingPercentage(displayProgress);
            yield return(new WaitForEndOfFrame());
        }
        op.allowSceneActivation = true;
        DelayComponent.Delay(100, () => { UIManeger.Instance.Show <MainView>(); });
    }
Exemple #2
0
    public override SensorComponent MakeComponent(GameObject gameObject)
    {
        DelayComponent component = gameObject.AddComponent <DelayComponent>();

        component.input   = input;
        component.onTime  = onTime;
        component.offTime = offTime;
        component.startOn = startOn;
        return(component);
    }
    public override void Execute(PolicyController controller)
    {
        DelayComponent dc = this;

        GameObject.FindGameObjectWithTag("GameController")
        .GetComponent <TurnController>()
        .DelayAction(turns, () => {
            PolicyController pc = Instantiate(policyControllerPrefab);
            pc.island           = controller.island;
            pc.Execute(false);
            Destroy(pc.gameObject);

            if (repeat)
            {
                dc.Execute(controller);
            }
        });
    }