blob: ccefe06b54712b7a90fa96d36021f2e3e86b6b22 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace TweenAnimation
{
// tween播放过程中产生事件
[Serializable]
public class TweenEvent
{
public string name; // 事件名
public float time; // 事件触发时间
public UnityEvent eventHandler; // 回调函数
}
public class TweenAnimation : MonoBehaviour
{
public enum EventTriggeredDirection
{
None = 0,
Forward = 1,
Backward = 2,
}
public enum PlaybackStyle
{
Once,
Loop,
PingPong,
}
public string description = "No Description";
public List<TweenModule> modules;
public float duration;
public PlaybackStyle playbackStyle;
public EventTriggeredDirection eventTriggeredDirection;
// 回放次数,0是不限制,默认是0
public int playbackLimit;
public List<TweenEvent> eventList;
public TweenAnimation()
{
this.playbackStyle = PlaybackStyle.Loop;
this.playbackLimit = 0;
this.duration = 1;
this.modules = new List<TweenModule>();
}
public void AddModule(TweenModule module)
{
if (modules == null)
modules = new List<TweenModule>();
modules.Add(module);
}
public void RemoveModule(TweenModule module)
{
if (modules == null)
return;
if (modules.Contains(module))
modules.Remove(module);
}
}
}
|