Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TCState.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class TCState : TC
4{
5 public SpriteRenderer sr;
6
8
9 private int index;
10
11 public override Vector3 FixPos => TC._setting.statePos;
12
13 public void SetSprite(MultiSprite _sprites)
14 {
15 if (sprites != _sprites)
16 {
17 CancelInvoke();
18 sprites = _sprites;
19 sr.sprite = sprites.frames[0];
20 if (sprites.frames.Length > 1)
21 {
22 index = 0;
23 InvokeRepeating("UpdateFrame", sprites.interval, sprites.interval);
24 }
25 }
26 }
27
28 private void OnDisable()
29 {
30 CancelInvoke();
31 sprites = null;
32 }
33
34 public void UpdateFrame()
35 {
36 index++;
37 if (index >= sprites.frames.Length)
38 {
39 index = 0;
40 }
41 sr.sprite = sprites.frames[index];
42 }
43}
float interval
Definition: MultiSprite.cs:9
Sprite[] frames
Definition: MultiSprite.cs:7
SpriteRenderer sr
Definition: TCState.cs:5
void OnDisable()
Definition: TCState.cs:28
void UpdateFrame()
Definition: TCState.cs:34
int index
Definition: TCState.cs:9
void SetSprite(MultiSprite _sprites)
Definition: TCState.cs:13
MultiSprite sprites
Definition: TCState.cs:7
override Vector3 FixPos
Definition: TCState.cs:11
Definition: TC.cs:4
static GameSetting.RenderSetting.TCSetting _setting
Definition: TC.cs:5