forked from hunterzonewu/unity-decompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.cs
More file actions
508 lines (446 loc) · 17.8 KB
/
Animation.cs
File metadata and controls
508 lines (446 loc) · 17.8 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
// Decompiled with JetBrains decompiler
// Type: UnityEngine.Animation
// Assembly: UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: A8FF7A2C-E4EE-4232-AB17-3FCABEC16496
// Assembly location: C:\Users\Blake\sandbox\unity\test-project\Library\UnityAssemblies\UnityEngine.dll
using System;
using System.Collections;
using System.Runtime.CompilerServices;
using UnityEngine.Internal;
namespace UnityEngine
{
/// <summary>
/// <para>The animation component is used to play back animations.</para>
/// </summary>
public sealed class Animation : Behaviour, IEnumerable
{
/// <summary>
/// <para>The default animation.</para>
/// </summary>
public AnimationClip clip { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] set; }
/// <summary>
/// <para>Should the default animation clip (the Animation.clip property) automatically start playing on startup?</para>
/// </summary>
public bool playAutomatically { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] set; }
/// <summary>
/// <para>How should time beyond the playback range of the clip be treated?</para>
/// </summary>
public WrapMode wrapMode { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] set; }
/// <summary>
/// <para>Are we playing any animations?</para>
/// </summary>
public bool isPlaying { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; }
public AnimationState this[string name]
{
get
{
return this.GetState(name);
}
}
/// <summary>
/// <para>When turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies.</para>
/// </summary>
public bool animatePhysics { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] set; }
/// <summary>
/// <para>When turned on, Unity might stop animating if it thinks that the results of the animation won't be visible to the user.</para>
/// </summary>
[Obsolete("Use cullingType instead")]
public bool animateOnlyIfVisible { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] set; }
/// <summary>
/// <para>Controls culling of this Animation component.</para>
/// </summary>
public AnimationCullingType cullingType { [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] get; [WrapperlessIcall, MethodImpl(MethodImplOptions.InternalCall)] set; }
/// <summary>
/// <para>AABB of this Animation animation component in local space.</para>
/// </summary>
public Bounds localBounds
{
get
{
Bounds bounds;
this.INTERNAL_get_localBounds(out bounds);
return bounds;
}
set
{
this.INTERNAL_set_localBounds(ref value);
}
}
/// <summary>
/// <para>Stops all playing animations that were started with this Animation.</para>
/// </summary>
public void Stop()
{
Animation.INTERNAL_CALL_Stop(this);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_Stop(Animation self);
/// <summary>
/// <para>Stops an animation named name.</para>
/// </summary>
/// <param name="name"></param>
public void Stop(string name)
{
this.Internal_StopByName(name);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private void Internal_StopByName(string name);
/// <summary>
/// <para>Rewinds the animation named name.</para>
/// </summary>
/// <param name="name"></param>
public void Rewind(string name)
{
this.Internal_RewindByName(name);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private void Internal_RewindByName(string name);
/// <summary>
/// <para>Rewinds all animations.</para>
/// </summary>
public void Rewind()
{
Animation.INTERNAL_CALL_Rewind(this);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_Rewind(Animation self);
/// <summary>
/// <para>Samples animations at the current state.</para>
/// </summary>
public void Sample()
{
Animation.INTERNAL_CALL_Sample(this);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_Sample(Animation self);
/// <summary>
/// <para>Is the animation named name playing?</para>
/// </summary>
/// <param name="name"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public bool IsPlaying(string name);
[ExcludeFromDocs]
public bool Play()
{
return this.Play(PlayMode.StopSameLayer);
}
/// <summary>
/// <para>Plays an animation without any blending.</para>
/// </summary>
/// <param name="mode"></param>
/// <param name="animation"></param>
public bool Play([DefaultValue("PlayMode.StopSameLayer")] PlayMode mode)
{
return this.PlayDefaultAnimation(mode);
}
/// <summary>
/// <para>Plays an animation without any blending.</para>
/// </summary>
/// <param name="mode"></param>
/// <param name="animation"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public bool Play(string animation, [DefaultValue("PlayMode.StopSameLayer")] PlayMode mode);
/// <summary>
/// <para>Plays an animation without any blending.</para>
/// </summary>
/// <param name="mode"></param>
/// <param name="animation"></param>
[ExcludeFromDocs]
public bool Play(string animation)
{
PlayMode mode = PlayMode.StopSameLayer;
return this.Play(animation, mode);
}
/// <summary>
/// <para>Fades the animation with name animation in over a period of time seconds and fades other animations out.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="mode"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public void CrossFade(string animation, [DefaultValue("0.3F")] float fadeLength, [DefaultValue("PlayMode.StopSameLayer")] PlayMode mode);
/// <summary>
/// <para>Fades the animation with name animation in over a period of time seconds and fades other animations out.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public void CrossFade(string animation, float fadeLength)
{
PlayMode mode = PlayMode.StopSameLayer;
this.CrossFade(animation, fadeLength, mode);
}
/// <summary>
/// <para>Fades the animation with name animation in over a period of time seconds and fades other animations out.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public void CrossFade(string animation)
{
PlayMode mode = PlayMode.StopSameLayer;
float fadeLength = 0.3f;
this.CrossFade(animation, fadeLength, mode);
}
/// <summary>
/// <para>Blends the animation named animation towards targetWeight over the next time seconds.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="targetWeight"></param>
/// <param name="fadeLength"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public void Blend(string animation, [DefaultValue("1.0F")] float targetWeight, [DefaultValue("0.3F")] float fadeLength);
/// <summary>
/// <para>Blends the animation named animation towards targetWeight over the next time seconds.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="targetWeight"></param>
/// <param name="fadeLength"></param>
[ExcludeFromDocs]
public void Blend(string animation, float targetWeight)
{
float fadeLength = 0.3f;
this.Blend(animation, targetWeight, fadeLength);
}
/// <summary>
/// <para>Blends the animation named animation towards targetWeight over the next time seconds.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="targetWeight"></param>
/// <param name="fadeLength"></param>
[ExcludeFromDocs]
public void Blend(string animation)
{
float fadeLength = 0.3f;
float targetWeight = 1f;
this.Blend(animation, targetWeight, fadeLength);
}
/// <summary>
/// <para>Cross fades an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public AnimationState CrossFadeQueued(string animation, [DefaultValue("0.3F")] float fadeLength, [DefaultValue("QueueMode.CompleteOthers")] QueueMode queue, [DefaultValue("PlayMode.StopSameLayer")] PlayMode mode);
/// <summary>
/// <para>Cross fades an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public AnimationState CrossFadeQueued(string animation, float fadeLength, QueueMode queue)
{
PlayMode mode = PlayMode.StopSameLayer;
return this.CrossFadeQueued(animation, fadeLength, queue, mode);
}
/// <summary>
/// <para>Cross fades an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public AnimationState CrossFadeQueued(string animation, float fadeLength)
{
PlayMode mode = PlayMode.StopSameLayer;
QueueMode queue = QueueMode.CompleteOthers;
return this.CrossFadeQueued(animation, fadeLength, queue, mode);
}
/// <summary>
/// <para>Cross fades an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="fadeLength"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public AnimationState CrossFadeQueued(string animation)
{
PlayMode mode = PlayMode.StopSameLayer;
QueueMode queue = QueueMode.CompleteOthers;
float fadeLength = 0.3f;
return this.CrossFadeQueued(animation, fadeLength, queue, mode);
}
/// <summary>
/// <para>Plays an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public AnimationState PlayQueued(string animation, [DefaultValue("QueueMode.CompleteOthers")] QueueMode queue, [DefaultValue("PlayMode.StopSameLayer")] PlayMode mode);
/// <summary>
/// <para>Plays an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public AnimationState PlayQueued(string animation, QueueMode queue)
{
PlayMode mode = PlayMode.StopSameLayer;
return this.PlayQueued(animation, queue, mode);
}
/// <summary>
/// <para>Plays an animation after previous animations has finished playing.</para>
/// </summary>
/// <param name="animation"></param>
/// <param name="queue"></param>
/// <param name="mode"></param>
[ExcludeFromDocs]
public AnimationState PlayQueued(string animation)
{
PlayMode mode = PlayMode.StopSameLayer;
QueueMode queue = QueueMode.CompleteOthers;
return this.PlayQueued(animation, queue, mode);
}
/// <summary>
/// <para>Adds a clip to the animation with name newName.</para>
/// </summary>
/// <param name="clip"></param>
/// <param name="newName"></param>
public void AddClip(AnimationClip clip, string newName)
{
this.AddClip(clip, newName, int.MinValue, int.MaxValue);
}
/// <summary>
/// <para>Adds clip to the only play between firstFrame and lastFrame. The new clip will also be added to the animation with name newName.</para>
/// </summary>
/// <param name="addLoopFrame">Should an extra frame be inserted at the end that matches the first frame? Turn this on if you are making a looping animation.</param>
/// <param name="clip"></param>
/// <param name="newName"></param>
/// <param name="firstFrame"></param>
/// <param name="lastFrame"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public void AddClip(AnimationClip clip, string newName, int firstFrame, int lastFrame, [DefaultValue("false")] bool addLoopFrame);
/// <summary>
/// <para>Adds clip to the only play between firstFrame and lastFrame. The new clip will also be added to the animation with name newName.</para>
/// </summary>
/// <param name="addLoopFrame">Should an extra frame be inserted at the end that matches the first frame? Turn this on if you are making a looping animation.</param>
/// <param name="clip"></param>
/// <param name="newName"></param>
/// <param name="firstFrame"></param>
/// <param name="lastFrame"></param>
[ExcludeFromDocs]
public void AddClip(AnimationClip clip, string newName, int firstFrame, int lastFrame)
{
bool addLoopFrame = false;
this.AddClip(clip, newName, firstFrame, lastFrame, addLoopFrame);
}
/// <summary>
/// <para>Remove clip from the animation list.</para>
/// </summary>
/// <param name="clip"></param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public void RemoveClip(AnimationClip clip);
/// <summary>
/// <para>Remove clip from the animation list.</para>
/// </summary>
/// <param name="clipName"></param>
public void RemoveClip(string clipName)
{
this.RemoveClip2(clipName);
}
/// <summary>
/// <para>Get the number of clips currently assigned to this animation.</para>
/// </summary>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public int GetClipCount();
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private void RemoveClip2(string clipName);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private bool PlayDefaultAnimation(PlayMode mode);
[Obsolete("use PlayMode instead of AnimationPlayMode.")]
public bool Play(AnimationPlayMode mode)
{
return this.PlayDefaultAnimation((PlayMode) mode);
}
[Obsolete("use PlayMode instead of AnimationPlayMode.")]
public bool Play(string animation, AnimationPlayMode mode)
{
return this.Play(animation, (PlayMode) mode);
}
public void SyncLayer(int layer)
{
Animation.INTERNAL_CALL_SyncLayer(this, layer);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_SyncLayer(Animation self, int layer);
public IEnumerator GetEnumerator()
{
return (IEnumerator) new Animation.Enumerator(this);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal AnimationState GetState(string name);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal AnimationState GetStateAtIndex(int index);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
internal int GetStateCount();
public AnimationClip GetClip(string name)
{
AnimationState state = this.GetState(name);
if ((bool) ((TrackedReference) state))
return state.clip;
return (AnimationClip) null;
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private void INTERNAL_get_localBounds(out Bounds value);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private void INTERNAL_set_localBounds(ref Bounds value);
private sealed class Enumerator : IEnumerator
{
private int m_CurrentIndex = -1;
private Animation m_Outer;
public object Current
{
get
{
return (object) this.m_Outer.GetStateAtIndex(this.m_CurrentIndex);
}
}
internal Enumerator(Animation outer)
{
this.m_Outer = outer;
}
public bool MoveNext()
{
int stateCount = this.m_Outer.GetStateCount();
++this.m_CurrentIndex;
return this.m_CurrentIndex < stateCount;
}
public void Reset()
{
this.m_CurrentIndex = -1;
}
}
}
}