Ejemplo n.º 1
0
        IEnumerator CoChange(float _time)
        {
            float        _percent         = 0;
            float        _speed           = 1f / _time;
            MaterialData _newMaterialData = PoolMaterial.ins.GetMaterial(originalMaterial);
            Material     _newMaterial     = _newMaterialData.mat;

            renderer.sharedMaterial = _newMaterial;
            Color _c1 = Color.clear;
            Color _c2 = originalMaterial.color;

            while (_percent < 1f)
            {
                _percent          += Time.deltaTime * _speed;
                _newMaterial.color = Color.Lerp(_c1, _c2, _percent);
                yield return(null);
            }
            _newMaterialData.Release();
            renderer.sharedMaterial = originalMaterial;
        }
Ejemplo n.º 2
0
        IEnumerator CoChange(float _time)
        {
            //Debug.Log (1);
            float        _percent         = 0;
            float        _speed           = 1f / _time;
            MaterialData _newMaterialData = PoolMaterial.ins.GetMaterial(originalMaterial);
            Material     _newMaterial     = _newMaterialData.mat;

            renderer.sharedMaterial = _newMaterial;
            //Color _c1 = Color.clear;
            //Color _c2 = originalMaterial.color;

            while (_percent < 1f)
            {
                _percent += Time.deltaTime * _speed;
                _newMaterial.mainTextureOffset = (Time.time * Vector3.right);
                yield return(null);
            }
            _newMaterialData.Release();
            renderer.sharedMaterial = originalMaterial;
        }