Exemplo n.º 1
0
 public void ChangeBgTexture(int nNewSceneId, float fPeriod)
 {
     //Prepare to Start
     _gmObjFrontBg.SetActive(true);
     MaterialFrontBg.SetFloat("_Alpha", 1);
     MaterialFrontBg.mainTexture = MaterialBackBg.mainTexture;
     MaterialBackBg.mainTexture  = ResourceMgr.Instance.CreatSceneBgTexture(nNewSceneId);
     SceneMgr.Instance.StartCoroutine(_graduallyChangingBgTexture(fPeriod));
 }
Exemplo n.º 2
0
        private IEnumerator _graduallyChangingBgTexture(float fPeriod)
        {
            float fRate  = 1 / fPeriod;
            float i      = 0;
            float fAlpha = 1;

            while (i <= 1)
            {
                i     += Time.deltaTime * fRate;
                fAlpha = 1 - i;
                MaterialFrontBg.SetFloat("_Alpha", fAlpha);
                yield return(null);
            }
            _gmObjFrontBg.SetActive(false);
        }