質問編集履歴

1

コードの追加

2018/04/19 03:26

投稿

kuru
kuru

スコア11

test CHANGED
File without changes
test CHANGED
@@ -5,3 +5,61 @@
5
5
  どう書いていいか教えてもらえませんか。
6
6
 
7
7
  宜しくお願い致します。
8
+
9
+ ```ここに言語を入力c#
10
+
11
+ コード
12
+
13
+ bool m_xPlus;
14
+
15
+ bool m_zplus;
16
+
17
+ public float xtime =2.0f;
18
+
19
+ public float shilyoki_ztime=4.0f;
20
+
21
+
22
+
23
+ void Update()
24
+
25
+ {
26
+
27
+ if (m_yPlus)
28
+
29
+ {
30
+
31
+ transform.position += new Vector3(0.0f, 5.0f * Time.deltaTime, 0.0f);
32
+
33
+ if (transform.position.y >= 4)
34
+
35
+ m_yPlus = false;
36
+
37
+ }
38
+
39
+ else if(m_zPlus)
40
+
41
+ {
42
+
43
+ transform.position += new Vector3(0.0f, 0.0f, 5.0f * Time.deltaTime);
44
+
45
+ time += Time.deltaTime;
46
+
47
+ print(time);
48
+
49
+ if(time>shilyoki_ztime)
50
+
51
+ {
52
+
53
+ m_zPlus = false;
54
+
55
+ }
56
+
57
+ }
58
+
59
+ }
60
+
61
+ ```
62
+
63
+ と書いて動くのですが、蛇行させようとするとかなり長いものになっちゃいます。
64
+
65
+ ほかに書き方はありますか?