teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

文章とタイトルを変更しました。

2020/01/12 08:18

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- 武器振り下ろす時だけを指定してする方法AnimationEventでfloat型の引数を取り0~1の時だけ判定したい。
1
+ animator getcurrentanimatorstateinfo () normalizedtime の使い方でAnimationClipを指定する方法
body CHANGED
@@ -1,9 +1,6 @@
1
- //////////コメント部の関数の中やっいるコドのなのですデバッグログが2回し呼ばれせん。
1
+ getcurrentanimatorstateinfo()normalizedtimeレイヤー番号を指定しション再生中どうかを知ることが出来すが?
2
- やりたいことは攻撃判が取れる間だんだん数字が増えていって0~1までの値float型で指定してその間に攻撃しているときダメジが入るという処理作りたいのすが0,1の値か入ってないと思われるのですがどうすればいいのでしょうか?
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
- ![イメージ説明](d7f64bd538550993dc12106fc42fbc1d.png)