43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.InputSystem.Utilities;
|
|
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
[Header("UI do ukrycia")]
|
|
public GameObject startCanvas;
|
|
|
|
[Header("Komponenty gracza")]
|
|
public PlayerMove movementScript;
|
|
public MouseLook lookScript;
|
|
|
|
// public MqttCollector mqttScript; // Odkomentujesz to póŸniej
|
|
|
|
private bool hasStarted = false;
|
|
|
|
void Start()
|
|
{
|
|
// Blokada na starcie
|
|
if (movementScript != null) movementScript.enabled = false;
|
|
if (lookScript != null) lookScript.canLook = false;
|
|
|
|
Cursor.lockState = CursorLockMode.None;
|
|
Cursor.visible = true;
|
|
|
|
// Czekamy na dowolny klawisz
|
|
InputSystem.onAnyButtonPress.CallOnce(ctrl => Begin());
|
|
}
|
|
|
|
void Begin()
|
|
{
|
|
if (hasStarted) return;
|
|
hasStarted = true;
|
|
|
|
if (startCanvas != null) startCanvas.SetActive(false);
|
|
if (movementScript != null) movementScript.enabled = true;
|
|
if (lookScript != null) lookScript.EnableLooking();
|
|
|
|
// if (mqttScript != null) mqttScript.BeginSession();
|
|
Debug.Log("Gra wystartowa³a!");
|
|
}
|
|
} |