blob: cc50e5ae523d29747bd4089abe47a6a34a528299 (
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
|
using UnityEngine;
public class SetAnimationByInput : MonoBehaviour
{
private InputHandler input;
private AnimationHandler anim;
private StandingDataHandler standingData;
private void Start()
{
anim = GetComponent<AnimationHandler>();
input = GetComponent<InputHandler>();
standingData = GetComponent<StandingDataHandler>();
}
private void Update()
{
if ((double)standingData.sinceGrounded > 0.2)
{
anim.animationState = 3;
}
else if (input.inputMovementDirection.magnitude > 0.1f)
{
if (input.isSpringting)
{
anim.animationState = 1;
}
else
{
anim.animationState = 2;
}
}
else
{
anim.animationState = 0;
}
}
}
|