質問編集履歴
2
自分で模索しながらやってますが未だにできません。スクリプトを最新のものにしておきます
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,31 +5,22 @@
|
|
5
5
|
using UnityEngine;
|
6
6
|
|
7
7
|
public class bakudan_con : MonoBehaviour
|
8
|
-
{
|
8
|
+
{
|
9
|
+
public GameObject niconico;
|
10
|
+
public static bakudan_con instance;
|
9
11
|
public bool nico;
|
10
|
-
public bool niconico;
|
11
12
|
|
12
13
|
public void Shoot(Vector3 dir)
|
13
14
|
{
|
14
15
|
GetComponent<Rigidbody>().AddForce(dir);
|
15
16
|
}
|
16
17
|
|
17
|
-
|
18
|
+
void OnCollisionEnter(Collision other)
|
18
19
|
{
|
19
|
-
|
20
|
+
if(other.gameObject.name == "niconico")
|
20
|
-
nico = true;
|
21
|
-
return nico;
|
22
|
-
}
|
23
|
-
|
24
|
-
public bool watasu()
|
25
|
-
{
|
26
|
-
if (nico == true)
|
27
21
|
{
|
28
|
-
nico
|
22
|
+
nico = true;
|
29
|
-
Debug.Log(niconico);
|
30
23
|
}
|
31
|
-
Debug.Log(niconico);
|
32
|
-
return niconico;
|
33
24
|
}
|
34
25
|
|
35
26
|
void Start()
|
@@ -44,27 +35,32 @@
|
|
44
35
|
using System.Collections;
|
45
36
|
using System.Collections.Generic;
|
46
37
|
using UnityEngine;
|
47
|
-
using UnityEngine.
|
38
|
+
using UnityEngine.UI;
|
39
|
+
|
48
40
|
|
49
41
|
public class movie : MonoBehaviour
|
50
42
|
{
|
51
|
-
public bakudan_con;
|
52
43
|
public GameObject Plane;
|
53
|
-
b
|
44
|
+
public Text timeText;
|
54
45
|
|
46
|
+
private float surviveTime;
|
55
47
|
|
56
48
|
void Start()
|
57
49
|
{
|
50
|
+
surviveTime = 0;
|
58
51
|
}
|
59
52
|
|
60
|
-
public void p
|
53
|
+
public void Update()
|
61
54
|
{
|
55
|
+
surviveTime += Time.deltaTime;
|
56
|
+
timeText.text = "Time:" + (int)surviveTime;
|
57
|
+
|
58
|
+
|
59
|
+
|
62
|
-
|
60
|
+
if (bakudan_con.instance.nico)
|
63
|
-
if(kitayatu == true)
|
64
61
|
{
|
65
62
|
Plane.SetActive(true);
|
66
63
|
}
|
67
64
|
}
|
68
65
|
}
|
69
|
-
|
70
66
|
```
|
1
説明が分かりにくかったのと、自分でやっていく中で変更したので修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,65 +1,46 @@
|
|
1
|
-
|
1
|
+
unityのゲームで衝突が起こったときにPlaneをセットアクティブにすることで爆発するmovieが流れるようにしたいのですが上手くいきません。どうしたらいいでしょうか?
|
2
|
-
どのように実装すればいいですか?
|
3
|
-
|
4
2
|
```C#
|
5
3
|
using System.Collections;
|
6
4
|
using System.Collections.Generic;
|
7
5
|
using UnityEngine;
|
8
6
|
|
9
7
|
public class bakudan_con : MonoBehaviour
|
10
|
-
{
|
8
|
+
{
|
11
|
-
public
|
9
|
+
public bool nico;
|
12
|
-
public bool nico
|
10
|
+
public bool niconico;
|
13
|
-
|
14
11
|
|
15
12
|
public void Shoot(Vector3 dir)
|
16
13
|
{
|
17
14
|
GetComponent<Rigidbody>().AddForce(dir);
|
18
15
|
}
|
19
16
|
|
20
|
-
|
17
|
+
bool OnCollisionEnter()
|
21
18
|
{
|
22
|
-
|
19
|
+
GetComponent<Rigidbody>().isKinematic = true;
|
23
|
-
|
20
|
+
nico = true;
|
21
|
+
return nico;
|
22
|
+
}
|
23
|
+
|
24
|
+
public bool watasu()
|
25
|
+
{
|
26
|
+
if (nico == true)
|
27
|
+
{
|
28
|
+
niconico = true;
|
29
|
+
Debug.Log(niconico);
|
30
|
+
}
|
31
|
+
Debug.Log(niconico);
|
32
|
+
return niconico;
|
24
33
|
}
|
25
34
|
|
26
35
|
void Start()
|
27
36
|
{
|
28
|
-
Shoot(new Vector3(0, 300, 1000));
|
37
|
+
//Shoot(new Vector3(0, 300, 1000));
|
29
|
-
}
|
38
|
+
}
|
30
39
|
}
|
31
40
|
|
32
41
|
```
|
33
42
|
|
34
|
-
```
|
43
|
+
```C#
|
35
|
-
using System.Collections;
|
36
|
-
using System.Collections.Generic;
|
37
|
-
using UnityEngine;
|
38
|
-
|
39
|
-
public class niconico_con : MonoBehaviour
|
40
|
-
{
|
41
|
-
public static niconico_con instance;
|
42
|
-
public bool ban = false;
|
43
|
-
|
44
|
-
|
45
|
-
void Start()
|
46
|
-
{
|
47
|
-
}
|
48
|
-
|
49
|
-
void OnCollisionEnter(Collision collision)
|
50
|
-
{
|
51
|
-
GetComponent<Rigidbody>().isKinematic = true;
|
52
|
-
ban = true;
|
53
|
-
}
|
54
|
-
|
55
|
-
void Update()
|
56
|
-
{
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
```
|
61
|
-
|
62
|
-
```
|
63
44
|
using System.Collections;
|
64
45
|
using System.Collections.Generic;
|
65
46
|
using UnityEngine;
|
@@ -67,23 +48,21 @@
|
|
67
48
|
|
68
49
|
public class movie : MonoBehaviour
|
69
50
|
{
|
70
|
-
public bool ban;
|
71
|
-
public b
|
51
|
+
public bakudan_con;
|
52
|
+
public GameObject Plane;
|
53
|
+
bool kitayatu;
|
72
54
|
|
73
|
-
|
55
|
+
|
74
56
|
void Start()
|
75
57
|
{
|
76
|
-
GetComponent<Rigidbody>().isKinematic = true;
|
77
|
-
var videoPlayer = GetComponent<VideoPlayer>();
|
78
|
-
videoPlayer.Pause();
|
79
58
|
}
|
80
59
|
|
81
60
|
public void play()
|
82
61
|
{
|
83
|
-
i
|
62
|
+
kitayatu = bakudan_con.watasu();
|
63
|
+
if(kitayatu == true)
|
84
64
|
{
|
85
|
-
var videoPlayer = GetComponent<VideoPlayer>();
|
86
|
-
|
65
|
+
Plane.SetActive(true);
|
87
66
|
}
|
88
67
|
}
|
89
68
|
}
|