예제 #1
0
        /// <summary>
        /// Start the tweening process.
        /// </summary>

        static public uSpringPosition Begin(GameObject go, Vector3 pos, float strength)
        {
            uSpringPosition sp = go.GetComponent <uSpringPosition>();

            if (sp == null)
            {
                sp = go.AddComponent <uSpringPosition>();
            }
            sp.target   = pos;
            sp.strength = strength;
            if (sp.onFinished == null)
            {
                sp.onFinished = new UnityEvent();
            }
            else
            {
                sp.onFinished.RemoveAllListeners();
            }

            if (!sp.enabled)
            {
                sp.mThreshold = 0f;
                sp.enabled    = true;
            }
            return(sp);
        }
예제 #2
0
        /// <summary>
        /// Notify all finished event listeners.
        /// </summary>

        void NotifyListeners()
        {
            current = this;

            if (onFinished != null)
            {
                onFinished.Invoke();
            }

            current = null;
        }