Elin Decompiled Documentation
EA 23.102 Nightly
Loading...
Searching...
No Matches
SpriteAnimation.cs
Go to the documentation of this file.
1
using
System;
2
using
UnityEngine;
3
4
[RequireComponent(typeof(SpriteRenderer))]
5
public
class
SpriteAnimation
: MonoBehaviour
6
{
7
[Serializable]
8
public
class
Item
9
{
10
public
Sprite
sprite
;
11
12
public
Vector3
pos
;
13
14
public
float
angle
;
15
16
public
float
angleRange
;
17
}
18
19
public
Item
[]
items
;
20
21
public
float
minInterval
;
22
23
public
float
maxInterval
;
24
25
public
bool
randomAngle
;
26
27
public
Transform
link
;
28
29
private
SpriteRenderer
sr
;
30
31
private
int
index
;
32
33
private
float
_baseAngle
;
34
35
private
float
interval
;
36
37
private
void
Awake
()
38
{
39
sr
= GetComponent<SpriteRenderer>();
40
sr.sprite =
items
[0].
sprite
;
41
interval
= UnityEngine.Random.Range(
minInterval
,
maxInterval
);
42
if
(
randomAngle
)
43
{
44
_baseAngle
= UnityEngine.Random.Range(0, 360);
45
}
46
InvokeRepeating(
"Refresh"
, 0f,
interval
);
47
}
48
49
private
void
Refresh
()
50
{
51
index
++;
52
if
(
index
>=
items
.Length)
53
{
54
index
= 0;
55
}
56
Item
item
=
items
[
index
];
57
sr.sprite =
item
.sprite;
58
if
((
bool
)
link
)
59
{
60
link.localPosition =
item
.pos;
61
link.localEulerAngles =
new
Vector3(0f, 0f,
_baseAngle
+
item
.angle + UnityEngine.Random.Range(0f -
item
.angleRange,
item
.angleRange));
62
}
63
}
64
}
ContainerFlag.item
@ item
SpriteAnimation.Item
Definition:
SpriteAnimation.cs:9
SpriteAnimation.Item.angleRange
float angleRange
Definition:
SpriteAnimation.cs:16
SpriteAnimation.Item.angle
float angle
Definition:
SpriteAnimation.cs:14
SpriteAnimation.Item.sprite
Sprite sprite
Definition:
SpriteAnimation.cs:10
SpriteAnimation.Item.pos
Vector3 pos
Definition:
SpriteAnimation.cs:12
SpriteAnimation
Definition:
SpriteAnimation.cs:6
SpriteAnimation.link
Transform link
Definition:
SpriteAnimation.cs:27
SpriteAnimation.Refresh
void Refresh()
Definition:
SpriteAnimation.cs:49
SpriteAnimation.minInterval
float minInterval
Definition:
SpriteAnimation.cs:21
SpriteAnimation.index
int index
Definition:
SpriteAnimation.cs:31
SpriteAnimation.maxInterval
float maxInterval
Definition:
SpriteAnimation.cs:23
SpriteAnimation.randomAngle
bool randomAngle
Definition:
SpriteAnimation.cs:25
SpriteAnimation.sr
SpriteRenderer sr
Definition:
SpriteAnimation.cs:29
SpriteAnimation.items
Item[] items
Definition:
SpriteAnimation.cs:19
SpriteAnimation._baseAngle
float _baseAngle
Definition:
SpriteAnimation.cs:33
SpriteAnimation.Awake
void Awake()
Definition:
SpriteAnimation.cs:37
SpriteAnimation.interval
float interval
Definition:
SpriteAnimation.cs:35
Elin
Plugins.basecore
SpriteAnimation.cs
Generated by
1.9.6