11using System.Collections;
12using System.Collections.Generic;
25 [Tooltip(
"The transform to which to apply the tweened properties.")]
28 [Tooltip(
"The transform whose position/rotation/localScale provide the start state of the tween.")]
30 [Tooltip(
"The transform whose position/rotation/localScale provide the end state of the tween.")]
35 [Header(
"Tween Settings")]
61 get {
return _tween; }
62 set { _tween = value; }
68 Debug.LogError(
"The start transform of the TransformTweenBehaviour should be "
69 +
"a different transform than the target transform; the start "
70 +
"transform provides starting position/rotation/scale information "
71 +
"for the tween.", this.gameObject);
74 Debug.LogError(
"The end transform of the TransformTweenBehaviour should be "
75 +
"a different transform than the target transform; the end "
76 +
"transform provides ending position/rotation/scale information "
77 +
"for the tween.", this.gameObject);
124 private Coroutine _playTweenAfterDelayCoroutine;
138 if (_playTweenAfterDelayCoroutine !=
null && tweenDirection != _curDelayedDirection) {
139 StopCoroutine(_playTweenAfterDelayCoroutine);
140 _curDelayedDirection = tweenDirection;
143 _playTweenAfterDelayCoroutine = StartCoroutine(playAfterDelay(tweenDirection, afterDelay));
146 private IEnumerator playAfterDelay(
Direction tweenDirection,
float delay) {
147 yield
return new WaitForSeconds(delay);
183 private void setTargetTo(Transform t) {
191 #region Unity Events (Internal)
193 [System.Serializable]
196 #pragma warning disable 0649
199 #pragma warning restore 0649
209 private void initUnityEvents() {
216 private void setupCallback(ref Action action,
EventType type) {
217 action += () => _eventTable.
Invoke((
int)type);
220 private void setupCallback<T>(ref Action<T> action,
EventType type) {
221 action += (anchObj) => _eventTable.
Invoke((
int)type);
void Invoke(int enumValue)
Tween Play()
Starts playing this Tween. It will continue from the same position it left off on,...
Tween OverTime(float seconds)
Specifies that this Tween should travel from begining to end over a certain number of seconds.
Tween OnProgress(Action< float > action)
Specifies an action to be called every step of the Tween. This callback happens after:
static Tween Persistent()
Creates a persistant Tween that will not ever auto-release itself. You must specifically call Release...
Tween OnReachEnd(Action action)
Specifies an action to be called whenever this Tween reaches the end.
Tween OnLeaveStart(Action action)
Specifies an action to be called whenever this Tween is Played forward when at the start.
Tween Smooth(SmoothType type=SmoothType.Smooth)
Specifies that this Tween should the given smoothing method.
bool isValid
Returns whether or not this Tween is considered valid. A Tween can become invalid under the following...
void Release()
Forces this Tween to be recycled right away. Once this method is called, the Tween will be invalid an...
Tween OnLeaveEnd(Action action)
Specifies an action to be called whenever this Tween is Played backwards when at the end.
MaterialSelector Target(Material material)
void Stop()
Stops this Tween. If it is not a persistant Tween, it will be recycled right away.
float progress
Gets or sets how far along completion this Tween is. This value is a percent that ranges from 0 to 1.
Tween OnReachStart(Action action)
Specifies an action to be called whenever this Tween reaches the start.