-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameController.cs
More file actions
43 lines (33 loc) · 982 Bytes
/
GameController.cs
File metadata and controls
43 lines (33 loc) · 982 Bytes
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController : MonoBehaviour {
public bool hideCursor = false;
public List<GameObject> temples;
public int currentTeleport = -1;
private void Start()
{
Cursor.visible = !hideCursor;
if (hideCursor)
{
Cursor.lockState = CursorLockMode.Locked;
}
else
{
Cursor.lockState = CursorLockMode.None;
}
}
public void TeleportToTemple()
{
Transform player = GameObject.FindWithTag("Player").transform;
foreach (Transform child in temples[currentTeleport].transform)
{
if (child.CompareTag("Teleport"))
{
player.position = child.position;
break;
}
}
temples[currentTeleport].GetComponent<Temple>().OpenDoor();
}
}