i3e-asg2/Assets/Scripts/Start.cs
2024-07-05 01:22:55 +08:00

29 lines
680 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StartUI : MonoBehaviour
{
public GameObject startUI;
GameObject player;
void Start()
{
player = GameObject.Find("PlayerCapsule");
player.GetComponent<CharacterControl>().active=false;
Time.timeScale = 0f;
Cursor.visible = true;
Cursor.lockState = CursorLockMode.Confined;
}
public void onStartGame()
{
player.GetComponent<CharacterControl>().active=true;
Time.timeScale = 1f;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
startUI.SetActive(false);
}
}