//public PTTColor color; public PYTweenAnimation SetColor(Color from, Color to, string colorProperty = "_Color") { Color = new PTTColor(from, to); renderers = GetComponentsInChildren <Renderer>(true); this.colorProperty = colorProperty; GetRenderers(); return(this); }
void ReverseDirection() { _hasReverted = !_hasReverted; Position = new PTTVector3(Position.to, Position.from, Position.isLocal, Position.isRelative, Position.ignoreAxis); Rotation = new PTTVector3(Rotation.to, Rotation.from, Rotation.isLocal, Rotation.isRelative, Rotation.ignoreAxis); Scale = new PTTVector3(Scale.to, Scale.from, Scale.isLocal, Scale.isRelative, Scale.ignoreAxis); Color = new PTTColor(Color.to, Color.from); Alpha = new PTTFloat(Alpha.to, Alpha.from); Float = new PTTFloat(Float.to, Float.from); if (AnimationData.Curve != null && FlipCurveOnReverse) { AnimationData.Curve = ReverseCurve(AnimationData.Curve); } }
void Initialize() { if (AnimationData == null) { Awake(); } Position = new PTTVector3(OwnTransform.position); Rotation = new PTTVector3(OwnTransform.eulerAngles); Scale = new PTTVector3(OwnTransform.localScale); if (GetComponent <Renderer>() != null && GetComponent <Renderer>().sharedMaterial != null) { Color = new PTTColor((GetComponent <Renderer>().sharedMaterial.HasProperty(colorProperty) ? GetComponent <Renderer>().sharedMaterial.GetColor(colorProperty) : UnityEngine.Color.white)); Alpha = new PTTFloat((GetComponent <Renderer>().sharedMaterial.HasProperty(colorProperty) ? GetComponent <Renderer>().sharedMaterial.GetColor(colorProperty).a : 1)); } else { Color = new PTTColor(UnityEngine.Color.white); Alpha = new PTTFloat(1); } Float = new PTTFloat(0); AnimationData.Duration = 1; Speed = 0; DelayToStart = 0; SetEaseType(Ease.Type.Linear); startCallback = null; updateCallback = null; finishCallback = null; _hasReverted = false; _loopcount = 0; AnimationData.Curve = AnimationCurve.Linear(0, 0, 1, 1); AnimationData.Loop = TagManager.LoopType.None; }