forked from whztt07/UnityGameplayAbilitySystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationBehaviourEventSystem.cs
More file actions
58 lines (45 loc) · 2.78 KB
/
Copy pathAnimationBehaviourEventSystem.cs
File metadata and controls
58 lines (45 loc) · 2.78 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class AnimationBehaviourEventSystem : StateMachineBehaviour {
public AnimationBehaviourStateEvent StateEnter = new AnimationBehaviourStateEvent();
public AnimationBehaviourStateEvent StateUpdate = new AnimationBehaviourStateEvent();
public AnimationBehaviourStateEvent StateExit = new AnimationBehaviourStateEvent();
public AnimationBehaviourStateEvent StateMove = new AnimationBehaviourStateEvent();
public AnimationBehaviourStateEvent StateIK = new AnimationBehaviourStateEvent();
public AnimationBehaviourStateMachineEvent StateMachineEnter = new AnimationBehaviourStateMachineEvent();
public AnimationBehaviourStateMachineEvent StateMachineExit = new AnimationBehaviourStateMachineEvent();
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
StateEnter.Invoke(animator, stateInfo, layerIndex);
}
// OnStateUpdate is called before OnStateUpdate is called on any state inside this state machine
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
StateUpdate.Invoke(animator, stateInfo, layerIndex);
}
// OnStateExit is called before OnStateExit is called on any state inside this state machine
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
StateExit.Invoke(animator, stateInfo, layerIndex);
}
// OnStateMove is called before OnStateMove is called on any state inside this state machine
override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
StateMove.Invoke(animator, stateInfo, layerIndex);
}
// OnStateIK is called before OnStateIK is called on any state inside this state machine
override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
StateIK.Invoke(animator, stateInfo, layerIndex);
}
// OnStateMachineEnter is called when entering a state machine via its Entry Node
override public void OnStateMachineEnter(Animator animator, int stateMachinePathHash) {
StateMachineEnter.Invoke(animator, stateMachinePathHash);
}
// OnStateMachineExit is called when exiting a state machine via its Exit Node
override public void OnStateMachineExit(Animator animator, int stateMachinePathHash) {
StateMachineExit.Invoke(animator, stateMachinePathHash);
}
}
public class AnimationBehaviourStateEvent : UnityEvent<Animator, AnimatorStateInfo, int> {
}
public class AnimationBehaviourStateMachineEvent : UnityEvent<Animator, int> {
}