blob: 1e97056eb39af85252102ff4112a903102ec0332 (
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
|
using UnityEngine;
public class StateController : StateMachineBehaviour
{
public string m_effectJoint = "";
public EffectList m_enterEffect = new EffectList();
public bool m_enterDisableChildren;
public bool m_enterEnableChildren;
public GameObject[] m_enterDisable = new GameObject[0];
public GameObject[] m_enterEnable = new GameObject[0];
private Transform m_effectJoinT;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (m_enterEffect.HasEffects())
{
m_enterEffect.Create(GetEffectPos(animator), animator.transform.rotation);
}
if (m_enterDisableChildren)
{
for (int i = 0; i < animator.transform.childCount; i++)
{
animator.transform.GetChild(i).gameObject.SetActive(value: false);
}
}
if (m_enterEnableChildren)
{
for (int j = 0; j < animator.transform.childCount; j++)
{
animator.transform.GetChild(j).gameObject.SetActive(value: true);
}
}
}
private Vector3 GetEffectPos(Animator animator)
{
if (m_effectJoint.Length == 0)
{
return animator.transform.position;
}
if (m_effectJoinT == null)
{
m_effectJoinT = Utils.FindChild(animator.transform, m_effectJoint);
}
return m_effectJoinT.position;
}
}
|