回答編集履歴
1
追記
answer
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
DOTweenAnimation.csを読んでみると、
|
2
2
|
LocalMoveのTOに対応するものはendValueV3だとわかります。
|
3
3
|
他にはこんなものがあります。
|
4
|
+
|
4
5
|
```c#
|
5
6
|
public float endValueFloat;
|
6
7
|
public Vector3 endValueV3;
|
@@ -10,11 +11,48 @@
|
|
10
11
|
public Rect endValueRect = new Rect(0, 0, 0, 0);
|
11
12
|
public Transform endValueTransform;
|
12
13
|
```
|
14
|
+
|
13
15
|
普通にGetComponentしてendValue3を書き換えただけだと反映されないので、
|
14
16
|
DORestart(true)する必要があります。
|
17
|
+
|
15
18
|
```c#
|
16
19
|
DOTweenAnimation dot = GetComponent<DOTweenAnimation>();
|
17
20
|
dot.endValueV3 = new Vector3(10.0f, 20.0f, 30.0f);
|
18
21
|
dot.DORestart(true);
|
22
|
+
```
|
19
23
|
|
24
|
+
私はRelativeにチェックを入れていたのでこれだけでできましたが、
|
25
|
+
絶対座標の場合はDOTweenAnimation.csを書き換えないとダメですね。
|
26
|
+
|
27
|
+
```c#
|
28
|
+
public override void DORestart(bool fromHere)
|
29
|
+
{
|
30
|
+
_playCount = -1;
|
31
|
+
if (tween == null) {
|
32
|
+
if (Debugger.logPriority > 1) Debugger.LogNullTween(tween); return;
|
33
|
+
}
|
34
|
+
if (fromHere && isRelative) ReEvaluateRelativeTween();
|
35
|
+
if (fromHere && !isRelative) ReEvaluateTween();//変更箇所
|
36
|
+
DOTween.Restart(this.gameObject);
|
37
|
+
}
|
38
|
+
```
|
39
|
+
|
40
|
+
ReEvaluateTween()はこれから作ります。
|
41
|
+
void ReEvaluateRelativeTween(){}の下にこれを追記してください。
|
42
|
+
|
43
|
+
```c#
|
44
|
+
void ReEvaluateTween()
|
45
|
+
{
|
46
|
+
GameObject tweenGO = GetTweenGO();
|
47
|
+
if (tweenGO == null) {
|
48
|
+
Debug.LogWarning(string.Format("{0} :: This DOTweenAnimation's target/GameObject is unset: the tween will not be created.", this.gameObject.name), this.gameObject);
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
if (animationType == AnimationType.Move) {
|
52
|
+
((Tweener)tween).ChangeEndValue(endValueV3, true);
|
53
|
+
} else if (animationType == AnimationType.LocalMove) {
|
54
|
+
((Tweener)tween).ChangeEndValue(endValueV3, true);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
20
58
|
```
|