質問編集履歴
2
質問が抽象的過ぎたので変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
オブジェクトの大きさの設定方法について
|
test
CHANGED
File without changes
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Unity初心者で現在1人でリズムゲームの作成を行なっている者です。
|
6
6
|
|
7
|
-
4ヶ月ほど前に、通常ノーツと同時押しノーツの生成までは実装できて次は長押しノーツを作成しようと考えていたのですがどう実装した方がいいのか想像できなくてずっと作業が停滞しているので質問させて
|
7
|
+
4ヶ月ほど前に、通常ノーツと同時押しノーツの生成までは実装できて次は長押しノーツを作成しようと考えていたのですがどう実装した方がいいのか想像できなくてずっと作業が停滞しているので質問させて頂きました。
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -28,92 +28,6 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
### 該当のソースコード
|
32
|
-
|
33
|
-
こちらが今使っている通常ノーツの移動させるスクリプトになります
|
34
|
-
|
35
|
-
```C#
|
36
|
-
|
37
|
-
using System.Collections;
|
38
|
-
|
39
|
-
using System.Collections.Generic;
|
40
|
-
|
41
|
-
using UnityEngine;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
public class NotesController : MonoBehaviour {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
public GameObject target; // 目標のオブジェクト
|
50
|
-
|
51
|
-
public float move_time; // このノーツの移動速度
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
private float time; // 移動距離を設定するためのタイマー
|
56
|
-
|
57
|
-
private Vector3 start_dir; // 開始の座標
|
58
|
-
|
59
|
-
private Vector3 target_dir; // 目標の座標
|
60
|
-
|
61
|
-
private Vector3 finish_dir; // 削除の座標
|
62
|
-
|
63
|
-
private bool flg = true; // 判定の中心に到着した時のフラグ
|
64
|
-
|
65
|
-
private LaneController parent; // 親のレーンのLaneController
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
public void Start() {
|
70
|
-
|
71
|
-
time = 0;
|
72
|
-
|
73
|
-
now_state = State.None;
|
74
|
-
|
75
|
-
move_time = 3f;
|
76
|
-
|
77
|
-
parent = transform.parent.GetComponent<LaneController>();
|
78
|
-
|
79
|
-
start_dir = this.transform.position;
|
80
|
-
|
81
|
-
target_dir = target.transform.position;
|
82
|
-
|
83
|
-
finish_dir = new Vector3(target_dir.x,
|
84
|
-
|
85
|
-
target_dir.y - (Mathf.Abs(start_dir.y) + Mathf.Abs(target_dir.y) - 0.5f),
|
86
|
-
|
87
|
-
target_dir.z - (Mathf.Abs(start_dir.z) + Mathf.Abs(target_dir.z) + 0.01f) );
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
public void Update() {
|
94
|
-
|
95
|
-
float v = time / move_time;
|
96
|
-
|
97
|
-
transform.position = Vector3.Lerp(flg ? start_dir : target_dir, // 三項演算子で目標を変更
|
98
|
-
|
99
|
-
flg ? target_dir : finish_dir, // 三項演算子で目標を変更
|
100
|
-
|
101
|
-
v);
|
102
|
-
|
103
|
-
time += Time.deltaTime;
|
104
|
-
|
105
|
-
if (this.transform.position.y < -0.01f) Destroy(gameObject);
|
106
|
-
|
107
|
-
}
|
108
|
-
|
109
|
-
}
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
```
|
114
|
-
|
115
|
-
|
116
|
-
|
117
31
|
### 補足情報(FW/ツールのバージョンなど)
|
118
32
|
|
119
33
|
MacBook Pro (15-inch, 2016)
|