-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.cs
75 lines (65 loc) · 1.72 KB
/
animation.cs
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class animation : MonoBehaviour
{
Animator animator;
bool isseated = false;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
bool wpress = Input.GetKey("w");
bool shiftpress = Input.GetKey("left shift");
bool fpress = Input.GetKey("f");
bool epress = Input.GetKey("e");
if (wpress && !isseated)
{
animator.SetBool("wpress", true);
}
if (!wpress && !isseated)
{
animator.SetBool("wpress", false);
}
if (shiftpress && !isseated)
{
animator.SetBool("shiftpress", true);
}
if (!shiftpress && !isseated)
{
animator.SetBool("shiftpress", false);
}
if (wpress && shiftpress && !isseated)
{
animator.SetBool("wpress", true);
animator.SetBool("shiftpress", true);
}
if (fpress && !isseated)
{
animator.SetBool("fpress", true);
isseated = true;
}
if (fpress && !isseated && !wpress)
{
animator.SetBool("fpress", true);
isseated = true;
}
if (isseated && wpress)
{
animator.SetBool("cyclewpress", true);
}
if (isseated && !wpress)
{
animator.SetBool("cyclewpress", false);
}
if (isseated && epress)
{
animator.SetBool("fpress", false);
isseated = false;
}
}
}