public Tweener Create()
        {
            if (_targ == null)
            {
                return(null);
            }

            //set curves
            Tweener tween = null;

            if (_props.Count > 1)
            {
                var grp = new TweenCurveGroup();
                for (int i = 0; i < _props.Count; i++)
                {
                    var curve = this.CreateCurve(_props[i]);
                    if (curve == null)
                    {
                        Debug.LogWarning("Failed to create tween for property '" + _props[i].name + "' on target.", _targ as Object);
                    }
                    else
                    {
                        grp.Curves.Add(curve);
                    }
                }
                tween = new ObjectTweener(_targ, grp);
            }
            else if (_props.Count == 1)
            {
                var curve = this.CreateCurve(_props[0]);
                if (curve == null)
                {
                    Debug.LogWarning("Failed to create tween for property '" + _props[0].name + "' on target.", _targ as UnityEngine.Object);
                    return(new ObjectTweener(_targ, TweenCurve.Null));
                }
                else
                {
                    tween = new ObjectTweener(_targ, curve);
                }
            }
            else
            {
                tween = new ObjectTweener(_targ, TweenCurve.Null);
            }

            //set props
            if (_id != null)
            {
                tween.Id = _id;
            }
            tween.UpdateType   = _updateType;
            tween.TimeSupplier = _timeSupplier;
            tween.SpeedScale   = _speedScale;
            tween.WrapMode     = _wrap;
            tween.WrapCount    = _wrapCount;
            tween.Reverse      = _reverse;
            tween.Delay        = _delay;
            if (_onStep != null)
            {
                tween.OnStep += _onStep;
            }
            if (_onWrap != null)
            {
                tween.OnWrap += _onWrap;
            }
            if (_onFinish != null)
            {
                tween.OnFinish += _onFinish;
            }
            if (_onStopped != null)
            {
                tween.OnStopped += _onStopped;
            }

            if (_prevNode != null)
            {
                var seq = new TweenSequence();
                seq.Id = tween.Id;
                seq.Tweens.Add(tween);

                var node = _prevNode;
                while (node != null)
                {
                    seq.Tweens.Insert(0, node.Create());
                    node = node._prevNode;
                }

                tween = seq;
            }

            return(tween);
        }
예제 #2
0
 internal CurveGroupCollection(TweenCurveGroup owner)
 {
     _owner = owner;
 }