MIF_E31211846/Assets/Scripts/ControlMateri.cs

94 lines
1.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class ControlMateri : MonoBehaviour
{
public GameObject GasPanel;
public GameObject PerubahanPanel;
// Start is called before the first frame update
void Start()
{
if (GasPanel != null)
{
GasPanel.SetActive(true);
}
else
{
Debug.LogWarning("GasPanel is not assigned.");
}
if (PerubahanPanel != null)
{
PerubahanPanel.SetActive(false);
}
else
{
Debug.LogWarning("PerubahanPanel is not assigned.");
}
}
// Remove Update method if not needed
// void Update() {}
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
public void ShowNextPanel()
{
if (GasPanel != null)
{
GasPanel.SetActive(false);
}
else
{
Debug.LogWarning("GasPanel is not assigned.");
}
if (PerubahanPanel != null)
{
PerubahanPanel.SetActive(true);
}
else
{
Debug.LogWarning("PerubahanPanel is not assigned.");
}
}
public void ShowPreviousPanel()
{
if (GasPanel != null)
{
GasPanel.SetActive(true);
}
else
{
Debug.LogWarning("GasPanel is not assigned.");
}
if (PerubahanPanel != null)
{
PerubahanPanel.SetActive(false);
}
else
{
Debug.LogWarning("PerubahanPanel is not assigned.");
}
}
public void ButtonScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
public void ButtonKembali(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}