-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMyTweenRotate.cs
54 lines (46 loc) · 1.18 KB
/
MyTweenRotate.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using DG.Tweening;
using UnityEngine;
namespace MTWrapper
{
public class MyTweenRotate : MyTween
{
public Transform objectToTween;
public Vector3 targetRotation;
private Tween myTween;
private void Start()
{
if(onStart)
PlayForward();
}
public override Tween BuildTween()
{
myTween = objectToTween.DOLocalRotate(targetRotation, duration).SetEase(easeType);
if (loop)
BuildTween().SetLoops(-1, loopType);
myTween.SetAutoKill(autoKill);
return myTween;
}
public override void PlayForward()
{
if (myTween == null)
BuildTween();
myTween.PlayForward();
}
public void PlayBackward()
{
if (myTween == null)
BuildTween();
myTween.PlayBackwards();
}
public override void Pause()
{
base.Pause();
myTween?.Pause();
}
public override Tween GetMyTween()
{
return myTween;
}
}
}