Exemple #1
0
 private void ShowCredits()
 {
     button.interactable = false;
     CoroutinesHandler.Get().RunCoroutineWithCheck(ref moveOutOfScreenCoroutine, MoveOutOfScreen());
     text.text = creditText;
     isShown   = true;
 }
    void Start()
    {
        Application.runInBackground = true;
        source.Play();

        CoroutinesHandler.Get().RunCoroutineWithCheck(ref spawnCloudsCoroutine, SpawnClouds());
    }
Exemple #3
0
 private void HideCredits()
 {
     button.interactable = true;
     CoroutinesHandler.Get().KillCoroutine(moveOutOfScreenCoroutine);
     button.transform.position = zeroPosition;
     text.text = "";
     isShown   = false;
 }
Exemple #4
0
    private void OnDisable()
    {
        CoroutinesHandler coroutinesHandler = CoroutinesHandler.Get();

        if (coroutinesHandler != null)
        {
            coroutinesHandler.KillCoroutine(moveOutOfScreenCoroutine);
        }
    }
Exemple #5
0
    private void OnDisable()
    {
        isShuttingDown = true;
        CoroutinesHandler coroutinesHandler = CoroutinesHandler.Get();

        if (coroutinesHandler != null)
        {
            coroutinesHandler.KillCoroutine(cloudMovingCoroutine);
        }
    }
Exemple #6
0
    private IEnumerator MoveOutOfScreen()
    {
        yield return(null);

        button.transform.position -= moveVector;

        if (button.transform.position.y > positionWhenCredits.y)
        {
            CoroutinesHandler.Get().RunCoroutineWithCheck(ref moveOutOfScreenCoroutine, MoveOutOfScreen());
        }
    }
    public void FadeOut()
    {
        button1.interactable = false;
        button2.interactable = false;

        CoroutinesHandler.Get().KillCoroutine(fadeInCoroutine);

        if (fadeOutCoroutine != null)
        {
            return;
        }
        CoroutinesHandler.Get().RunCoroutine(fadeOutCoroutine, DoFadeOut());
    }
    private void OnDisable()
    {
        Coroutine[] coroutinesToKill =
        {
            fadeInCoroutine,
            fadeOutCoroutine
        };

        CoroutinesHandler coroutinesHandler = CoroutinesHandler.Get();

        if (coroutinesHandler != null)
        {
            coroutinesHandler.KillGivenCoroutines(coroutinesToKill);
        }
    }
Exemple #9
0
    private IEnumerator MoveClouds()
    {
        yield return(null);

        if (!isShuttingDown)
        {
            for (int i = 0; i < clouds.Count; i++)
            {
                if (i == 2 || i == 3)
                {
                    clouds[i].transform.position += fastCloud;
                }
                else
                {
                    clouds[i].transform.position += slowCloud;
                }
            }

            CoroutinesHandler.Get().RunCoroutineWithCheck(ref cloudMovingCoroutine, MoveClouds());
        }
    }
    private IEnumerator CheckHour()
    {
        currentTime = System.DateTime.Now.Hour;

        if (currentTime >= 8 && currentTime < 16)
        {
            meshRenderer.material.SetTexture("_MainTex", onDay);
        }
        else if (currentTime >= 16 && currentTime < 22)
        {
            meshRenderer.material.SetTexture("_MainTex", onEvening);
        }
        else
        {
            meshRenderer.material.SetTexture("_MainTex", onNight);
        }

        yield return(new WaitForSecondsRealtime(refreshTimeCheckingInterval));

        CoroutinesHandler.Get().RunCoroutineWithCheck(ref checkTimeCoroutine, CheckHour());
    }
Exemple #11
0
    public static CoroutinesHandler Get()
    {
        if (isShutingDown)
        {
            return(null);
        }

        lock (_lock)
        {
            if (instance == null)
            {
                instance = (CoroutinesHandler)FindObjectOfType(typeof(CoroutinesHandler));

                if (instance == null)
                {
                    GameObject newGameObject = new GameObject(typeof(CoroutinesHandler).ToString());
                    instance = newGameObject.AddComponent <CoroutinesHandler>();
                    DontDestroyOnLoad(newGameObject);
                }
            }

            return(instance);
        }
    }
 void Start()
 {
     CoroutinesHandler.Get().RunCoroutineWithCheck(ref fadeInCoroutine, DoFadeIn());
 }
Exemple #13
0
 private void Start()
 {
     CoroutinesHandler.Get().RunCoroutineWithCheck(ref cloudMovingCoroutine, MoveClouds());
 }
 private void Start()
 {
     CoroutinesHandler.Get().RunCoroutineWithCheck(ref checkTimeCoroutine, CheckHour());
 }