Plugin MQTT i test sceny testowej
This commit is contained in:
43
Assets/Scripts/GameManager.cs
Normal file
43
Assets/Scripts/GameManager.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
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!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user