LTDescr.setAlpha C# (CSharp) Method

setAlpha() public method

public setAlpha ( ) : LTDescr
return LTDescr
    public LTDescr setAlpha()
    {
        this.type = TweenAction.ALPHA;
        this.initInternal = ()=>{
            #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
            if(trans.gameObject.renderer){ this.fromInternal.x = trans.gameObject.renderer.material.color.a; }else if(trans.childCount>0){ foreach (Transform child in trans) { if(child.gameObject.renderer!=null){ Color col = child.gameObject.renderer.material.color; this.fromInternal.x = col.a; break; }}}
            this.easeInternal = this.alpha;
            break;
            #else
            SpriteRenderer ren = trans.gameObject.GetComponent<SpriteRenderer>();
            if(ren!=null){
                this.fromInternal.x = ren.color.a;
            }else{
                if(trans.gameObject.GetComponent<Renderer>()!=null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_Color")){
                    this.fromInternal.x = trans.gameObject.GetComponent<Renderer>().material.color.a;
                }else if(trans.gameObject.GetComponent<Renderer>()!=null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_TintColor")){
                    Color col = trans.gameObject.GetComponent<Renderer>().material.GetColor("_TintColor");
                    this.fromInternal.x = col.a;
                }else if(trans.childCount>0){
                    foreach (Transform child in trans) {
                        if(child.gameObject.GetComponent<Renderer>()!=null){
                            Color col = child.gameObject.GetComponent<Renderer>().material.color;
                            this.fromInternal.x = col.a;
                            break;
                        }
                    }
                }
            }
            #endif

            this.easeInternal = ()=>{
                val = easeMethod().x;
                #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
                alphaRecursive(this.trans, val, this.useRecursion);
                #else
                if(this.spriteRen!=null){
                    this.spriteRen.color = new Color( this.spriteRen.color.r, this.spriteRen.color.g, this.spriteRen.color.b, val);
                    alphaRecursiveSprite(this.trans, val);
                }else{
                    alphaRecursive(this.trans, val, this.useRecursion);
                }
                #endif
            };

        };
        this.easeInternal = ()=>{
            newVect = easeMethod();
            val = newVect.x;
            #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
            alphaRecursive(this.trans, val, this.useRecursion);
            #else
            if(this.spriteRen!=null){
                this.spriteRen.color = new Color( this.spriteRen.color.r, this.spriteRen.color.g, this.spriteRen.color.b, val);
                alphaRecursiveSprite(this.trans, val);
            }else{
                alphaRecursive(this.trans, val, this.useRecursion);
            }
            #endif
        };
        return this;
    }
LTDescr