回答編集履歴
4
コード修正
answer
CHANGED
@@ -51,7 +51,6 @@
|
|
51
51
|
{
|
52
52
|
Vector2 vec;
|
53
53
|
private float speeds = 0;
|
54
|
-
|
55
54
|
private bool isBulletStart;
|
56
55
|
|
57
56
|
void Start()
|
@@ -65,17 +64,17 @@
|
|
65
64
|
{
|
66
65
|
Vector3 mousePositionVec3 = Input.mousePosition;
|
67
66
|
mousePositionVec3.z = -Camera.main.transform.position.z;
|
68
|
-
|
67
|
+
|
69
68
|
vec = Camera.main.ScreenToWorldPoint(mousePositionVec3);
|
70
|
-
|
69
|
+
|
71
|
-
float zRotation = Mathf.Atan2(vec.y - transform.position.y, vec.x - transform.position.x) * Mathf.Rad2Deg
|
70
|
+
float zRotation = Mathf.Atan2(vec.y - transform.position.y, vec.x - transform.position.x) * Mathf.Rad2Deg;
|
72
71
|
transform.rotation = Quaternion.Euler(0f, 0f, zRotation);
|
73
72
|
speeds = 0.2f;
|
74
73
|
isBulletStart = true;
|
75
74
|
}
|
76
|
-
|
77
|
-
transform.Translate(Vector2.up * speeds);
|
78
75
|
|
76
|
+
transform.Translate(Vector2.right * speeds);
|
77
|
+
|
79
78
|
if (transform.position.x > 10 || transform.position.y > 10)
|
80
79
|
{
|
81
80
|
isBulletStart = false;
|
3
コード修正
answer
CHANGED
@@ -53,7 +53,6 @@
|
|
53
53
|
private float speeds = 0;
|
54
54
|
|
55
55
|
private bool isBulletStart;
|
56
|
-
private float zRotation;
|
57
56
|
|
58
57
|
void Start()
|
59
58
|
{
|
@@ -69,7 +68,7 @@
|
|
69
68
|
|
70
69
|
vec = Camera.main.ScreenToWorldPoint(mousePositionVec3);
|
71
70
|
|
72
|
-
zRotation = Mathf.Atan2(vec.y - transform.position.y, vec.x - transform.position.x) * Mathf.Rad2Deg - 90f;
|
71
|
+
float zRotation = Mathf.Atan2(vec.y - transform.position.y, vec.x - transform.position.x) * Mathf.Rad2Deg - 90f;
|
73
72
|
transform.rotation = Quaternion.Euler(0f, 0f, zRotation);
|
74
73
|
speeds = 0.2f;
|
75
74
|
isBulletStart = true;
|
2
文章修正
answer
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
これでクリックした方向に弾は向かっていくのではないでしょうか。
|
42
42
|
ただこれだと指定した位置に移動するだけなので近くをクリックするとそこで止まってしまいますし、途中で方向転換も可能です。
|
43
43
|
|
44
|
-
次にクリック角度方向に真っすぐ進み、進行中は入力を受け付けない
|
44
|
+
次にクリック角度方向に真っすぐ進み、進行中は入力を受け付けない作りにすると
|
45
45
|
```C#
|
46
46
|
using System.Collections;
|
47
47
|
using System.Collections.Generic;
|
1
文章修正
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
最初のコードを出来るだけ崩さず修正すると
|
1
|
+
最初のコードを出来るだけ崩さず指定した方向に進むよう修正すると
|
2
2
|
|
3
3
|
```C#
|
4
4
|
using System.Collections;
|