protected virtual void Start() { if (eventSystem == null) { eventSystem = EventSystem.current; } #if UNITY_2019_1_OR_NEWER var numSelectables = Selectable.allSelectablesArray.Length; #else var numSelectables = Selectable.allSelectables.Count; #endif becameSelectedTween = new TweenQueue[numSelectables]; for (int index = 0; index < numSelectables; index++) { #if UNITY_2019_1_OR_NEWER Selectable selectable = Selectable.allSelectablesArray[index]; #else Selectable selectable = Selectable.allSelectables[index]; #endif becameSelectedTween[index] = selectable.GetComponent <TweenQueue>(); int qInd = becameSelectedTween[index].GetNamedIndex(Q_ON_SELECTED); if (qInd < 0) { continue; } foreach (TweenBase tweenBase in becameSelectedTween[index].itemQueue[qInd].tweens) { tweenBase.SetToLerpPoint(0); } } moveTween = (TweenPosition)TweenBase.AddTween <TweenPosition>(gameObject, play: false, loop: false).SetAnimationCurve(AnimationCurves.AnimationCurveType.EaseIn); moveTween.events.onLoopComplete = new UnityEvent(); moveTween.events.onLoopComplete.AddListener(OnDestinationArrive); rotationTween = (TweenRotation)TweenBase.AddTween <TweenRotation>(gameObject, play: false, loop: false).SetAnimationCurve(AnimationCurves.AnimationCurveType.EaseIn); rotationTween.interpolationCurve.postWrapMode = WrapMode.Clamp; var initialRotation = transform.eulerAngles; rotationTween.values[0].x = initialRotation.x; rotationTween.values[0].z = initialRotation.z; rotationTween.values[1].x = initialRotation.x; rotationTween.values[1].z = initialRotation.z; }
private void Start() { newTween = (TweenPosition)TweenBase.AddTween <TweenPosition>(this.gameObject).SetStartValue(Vector3.zero).SetEndValue(0, 5f, 0).SetTime(0.6f).SetAnimationCurve(AnimationCurves.AnimationCurveType.Sin); newTween.events.onLoopComplete.AddListener(KillTweenComponent); }