blob: c2a206b05aec3bde6d0e1c3bee57f67b56211cdf (
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
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Rigging.Data
{
[DisallowMultipleComponent]
public class SetAnimationByInput : RiggingDataBase
{
private Rigging.Inputs.InputHandler input;
private AnimationHandler anim;
private StandingDataHandler standingData;
protected override void OnStart()
{
input = player.input;
anim = player.status.animation;
standingData = player.status.standingData;
}
private void Update()
{
if ((double)standingData.sinceGrounded > 0.2)
{
//anim.animationState = 3; // jump
}
else if (input.inputMovementDirection.magnitude > 0.1f)
{
if (input.isSpringting)
{
anim.animationState = 2; // sprint
}
else
{
anim.animationState = 1; // run
}
}
else
{
anim.animationState = 0; // stand
}
}
}
}
|