質問編集履歴
1
文章とタイトルを変更しました。
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
animator getcurrentanimatorstateinfo () normalizedtime の使い方でAnimationClipを指定する方法
|
body
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
|
1
|
+
getcurrentanimatorstateinfo()normalizedtimeでレイヤー番号を指定してモーションが再生中かどうかを知ることが出来ますが?
|
2
|
-
|
2
|
+
その時に特定のアニメーションを選択してそのモーションをnormalizedtimeで時間を取得したいです。
|
3
3
|
|
4
|
-
※もし0~1の値が入っていればデバッグログでもっと表示が出るはずなのでがおかしいのは確かです。
|
5
|
-
|
6
|
-
|
7
4
|
```ここに言語を入力
|
8
5
|
using System.Collections;
|
9
6
|
using System.Collections.Generic;
|
@@ -13,6 +10,7 @@
|
|
13
10
|
{
|
14
11
|
|
15
12
|
private Animator ani;
|
13
|
+
private Animation anition;
|
16
14
|
private GameObject playerChild;
|
17
15
|
private Weapon wp;
|
18
16
|
|
@@ -23,6 +21,7 @@
|
|
23
21
|
playerChild = GameObject.Find("B_R_Hand");
|
24
22
|
wp = playerChild.GetComponent<Weapon>();
|
25
23
|
ani = GetComponent<Animator>();
|
24
|
+
anition = GetComponent<Animation>();
|
26
25
|
}
|
27
26
|
|
28
27
|
// Update is called once per frame
|
@@ -33,21 +32,23 @@
|
|
33
32
|
ani.SetTrigger("Attack");
|
34
33
|
}
|
35
34
|
|
36
|
-
if(ani.GetCurrentAnimatorStateInfo(0).IsName("Attack") == true)
|
35
|
+
if(ani.GetCurrentAnimatorStateInfo(0).IsName("Attack") == true)////ここのコード
|
36
|
+
|
37
|
+
// if(anition["Attack1"].normalizedTime > 0.25f)
|
37
38
|
{
|
38
39
|
if(wp.EnemyCol == true)
|
39
40
|
{
|
40
41
|
Debug.Log("ダメージ!!!");
|
41
42
|
|
42
43
|
Destroy(wp.del);
|
43
|
-
}
|
44
|
+
}
|
45
|
+
}
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
// anition["Attack"].normalizedTime = 0.5f;
|
48
|
+
|
48
49
|
}
|
49
50
|
|
50
|
-
|
51
|
+
|
51
52
|
private void Hit(float ae)
|
52
53
|
{
|
53
54
|
if(ae >= 0.0 && ae <= 1.0){
|
@@ -55,10 +56,8 @@
|
|
55
56
|
}
|
56
57
|
|
57
58
|
}
|
58
|
-
|
59
|
+
|
59
60
|
|
60
61
|
}
|
61
62
|
|
62
|
-
```
|
63
|
+
```
|
63
|
-
|
64
|
-

|