Example #1
0
        private TweenAction AddTween(Transform obj, Vector3 target, TweenAction.Type type, float duration, float delay, System.Func <float, float> ease, int easeIndex = -1, bool removeOld = true)
        {
            // remove old ones of same object
            if (removeOld)
            {
                for (int i = _actions.Count - 1; i >= 0; i--)
                {
                    if (_actions[i].theObject == obj && _actions[i].type == type)
                    {
                        _actions.RemoveAt(i);
                    }
                }
            }

            var act = new TweenAction
            {
                type          = type,
                theObject     = obj,
                targetPos     = target,
                tweenPos      = 0f,
                tweenDuration = duration,
                tweenDelay    = delay,
                customEasing  = easeIndex
            };

            _actions.Add(act);

            act.easeFunction = ease;

            return(act);
        }
Example #2
0
    private TweenAction AddTween(Transform obj, Vector3 target, TweenAction.Type type, float duration, float delay, System.Func <float, float> ease, int easeIndex = -1)
    {
        // remove old ones of same object
        for (int i = actions.Count - 1; i >= 0; i--)
        {
            if (actions[i].theObject == obj && actions[i].type == type)
            {
                actions.RemoveAt(i);
            }
        }

        TweenAction act = new TweenAction();

        act.type          = type;
        act.theObject     = obj;
        act.targetPos     = target;
        act.tweenPos      = 0f;
        act.tweenDuration = duration;
        act.tweenDelay    = delay;
        act.customEasing  = easeIndex;
        actions.Add(act);

        act.easeFunction = ease;

        return(act);
    }