public LTDescr setColor()
{
this.type = TweenAction.COLOR;
this.initInternal = ()=>{
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
if(trans.gameObject.renderer){
this.setFromColor( trans.gameObject.renderer.material.color );
}else if(trans.childCount>0){
foreach (Transform child in trans) {
if(child.gameObject.renderer!=null){
this.setFromColor( child.gameObject.renderer.material.color );
break;
}
}
}
#else
SpriteRenderer renColor = trans.gameObject.GetComponent<SpriteRenderer>();
if(renColor!=null){
this.setFromColor( renColor.color );
}else{
if(trans.gameObject.GetComponent<Renderer>()!=null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_Color")){
Color col = trans.gameObject.GetComponent<Renderer>().material.color;
this.setFromColor( col );
}else if(trans.gameObject.GetComponent<Renderer>()!=null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_TintColor")){
Color col = trans.gameObject.GetComponent<Renderer>().material.GetColor ("_TintColor");
this.setFromColor( col );
}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.setFromColor( col );
break;
}
}
}
}
#endif
};
this.easeInternal = ()=>{
newVect = easeMethod();
val = newVect.x;
Color toColor = tweenColor(this, val);
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
if(this.spriteRen!=null){
this.spriteRen.color = toColor;
colorRecursiveSprite( trans, toColor);
}else{
#endif
// Debug.Log("val:"+val+" tween:"+tween+" tween.diff:"+tween.diff);
if(this.type==TweenAction.COLOR)
colorRecursive(trans, toColor, this.useRecursion);
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
}
#endif
if(dt!=0f && this._optional.onUpdateColor!=null){
this._optional.onUpdateColor(toColor);
}else if(dt!=0f && this._optional.onUpdateColorObject!=null){
this._optional.onUpdateColorObject(toColor, this._optional.onUpdateParam);
}
};
return this;
}