質問編集履歴

3

文法の改善

2021/08/03 05:33

投稿

hosituka
hosituka

スコア15

test CHANGED
File without changes
test CHANGED
@@ -24,13 +24,13 @@
24
24
 
25
25
  GetComponent<Renderer>().material.color -= new Color(0,0,0,0.01f);
26
26
 
27
- yield return new WaitForSeconds(0.05f);
27
+
28
28
 
29
29
 
30
30
 
31
31
  }
32
32
 
33
-
33
+ yield return new WaitForSeconds(0.05f);
34
34
 
35
35
  }
36
36
 

2

情報の付け足し

2021/08/03 05:33

投稿

hosituka
hosituka

スコア15

test CHANGED
File without changes
test CHANGED
@@ -2,29 +2,41 @@
2
2
 
3
3
  ```C#
4
4
 
5
- if( gameObject.GetComponent<Renderer>().material.color == null)
5
+ private IEnumerator teki_fadeout()
6
6
 
7
7
  {
8
8
 
9
- //colorがなかった場合の処理
9
+ for (float a = 1; a == 0; a-=0.01f)
10
10
 
11
- }
11
+ {
12
12
 
13
- else
13
+ if( gameObject.GetComponent<Renderer>().material.color == null)
14
14
 
15
- {
15
+ {
16
16
 
17
- for (float a = 1; a == 0; a-=0.01f)
17
+ //colorがなかった場合の処理
18
18
 
19
- {
19
+ }
20
20
 
21
-
21
+ else
22
22
 
23
- GetComponent<Renderer>().material.color -= new Color(0,0,0,0.01f);
23
+ {
24
24
 
25
- yield return new WaitForSeconds(0.05f);
25
+ GetComponent<Renderer>().material.color -= new Color(0,0,0,0.01f);
26
26
 
27
+ yield return new WaitForSeconds(0.05f);
28
+
29
+
30
+
27
- }
31
+ }
32
+
33
+
34
+
35
+ }
36
+
37
+
38
+
39
+ Destroy(gameObject);
28
40
 
29
41
  }
30
42
 

1

fadeoutする部分追加

2021/08/03 05:32

投稿

hosituka
hosituka

スコア15

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,17 @@
14
14
 
15
15
  {
16
16
 
17
- //colorがあった場合の処理
17
+ for (float a = 1; a == 0; a-=0.01f)
18
+
19
+ {
20
+
21
+
22
+
23
+ GetComponent<Renderer>().material.color -= new Color(0,0,0,0.01f);
24
+
25
+ yield return new WaitForSeconds(0.05f);
26
+
27
+ }
18
28
 
19
29
  }
20
30