-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoorController.cs
More file actions
51 lines (36 loc) · 1.24 KB
/
Copy pathDoorController.cs
File metadata and controls
51 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Video;
// This script is attached to the door in Wangari's scene
// This script is using the UnityEngine.Video class
// This script disables Wangari's environment and enables Rachel's environment and the TV in her study
// When either player's hand collides with the door.
public class DoorController : MonoBehaviour
{
public GameObject WangariEnvironment;
public GameObject RachelEnvironment;
public Material Rachel_Default_sky;
public GameObject Tv_Video;
public VideoPlayer Tv_Video_Component;
void Start()
{
Tv_Video_Component = Tv_Video.GetComponent<VideoPlayer>();
}
private void OnTriggerEnter(Collider other)
{
if (other.tag == "hand")
{
Debug.Log("something collided with door");
RachelEnvironment.SetActive(true);
Tv_Video_Component.enabled = true;
WangariEnvironment.SetActive(false);
RenderSettings.skybox = Rachel_Default_sky;
}
else
{
WangariEnvironment.SetActive(true);
}
}
}