Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            TweenPos self = (TweenPos)target;

            EditorGUILayout.BeginHorizontal();
            self.from = EditorGUILayout.Vector3Field("From", self.from);
            if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
            {
                self.FromCurrentValue();
            }
            EditorGUILayout.EndHorizontal();
            self.fromOffset = EditorGUILayout.Toggle("Offset", self.fromOffset);

            EditorGUILayout.BeginHorizontal();
            self.to = EditorGUILayout.Vector3Field("To", self.to);
            if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
            {
                self.ToCurrentValue();
            }
            EditorGUILayout.EndHorizontal();
            self.toOffset = EditorGUILayout.Toggle("Offset", self.toOffset);

            self.CSpace = (Space)EditorGUILayout.EnumPopup("Coordinate Space", self.CSpace);
            EditorGUILayout.Separator();

            BaseTweenerProperties();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a TweenPos Component and start a tween
        /// </summary>
        /// <param name="go">GameObject to apply tween too</param>
        /// <param name="duration">Duration of tween</param>
        /// <param name="fromVal">The starting value for the tween</param>
        /// <param name="toVal">The ending value for the tween</param>
        /// <param name="style">The style of tween (Once, Looped, PingPong)</param>
        /// <param name="method">The Interpolation method of the tween</param>
        /// <param name="finished">A optional Callback to fire when the tween is done</param>
        /// <param name="cSpace">A optional Arugmeant to define the coordnaite space to work in</param>
        /// <returns>Return reference to the new TweenPos component</returns>
        public static TweenPos Tween(GameObject go, float duration, Vector3 fromVal, Vector3 toVal,
                                     Style style, Method method, UnityAction finished = null, CSpace cSpace = CSpace.Anchored)
        {
            TweenPos cls = TweenMain.Tween <TweenPos>(go, duration, style, method, finished);

            cls.CSpace = cSpace;
            cls.from   = fromVal;
            cls.to     = toVal;
            cls.Start();
            return(cls);
        }