質問編集履歴

2

改善

2019/12/25 14:33

投稿

hidetoshimori
hidetoshimori

スコア12

test CHANGED
File without changes
test CHANGED
@@ -50,7 +50,7 @@
50
50
 
51
51
  speed += 0.5f*Time.deltaTime;
52
52
 
53
- anim.SetFloat("speed", 1);
53
+ anim.SetFloat("speed", speed);
54
54
 
55
55
  }
56
56
 

1

改善

2019/12/25 14:33

投稿

hidetoshimori
hidetoshimori

スコア12

test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,63 @@
8
8
 
9
9
  ![イメージ説明](87467cacced47ac636673f99ecda8e35.png)
10
10
 
11
+ ###animcontroller.cs
11
12
 
13
+ using System.Collections;
14
+
15
+ using System.Collections.Generic;
16
+
17
+ using UnityEngine;
18
+
19
+
20
+
21
+ public class animcon : MonoBehaviour
22
+
23
+ {
24
+
25
+ public Animator anim;
26
+
27
+ public float speed=0;
28
+
29
+ // Start is called before the first frame update
30
+
31
+ void Start()
32
+
33
+ {
34
+
35
+
36
+
37
+ }
38
+
39
+
40
+
41
+ // Update is called once per frame
42
+
43
+ void Update()
44
+
45
+ {
46
+
47
+ if (Input.GetKey(KeyCode.W))
48
+
49
+ {
50
+
51
+ speed += 0.5f*Time.deltaTime;
52
+
53
+ anim.SetFloat("speed", 1);
54
+
55
+ }
56
+
57
+ else{
58
+
59
+ anim.SetFloat("speed", 0);
60
+
61
+ }
62
+
63
+
64
+
65
+ }
66
+
67
+ }
12
68
 
13
69
 
14
70