zombie_mp/Assets/HQ FPS Weapons/Scripts/Demo/DemoInstructions.cs
Sewmina Dilshan 68183e5317 initial
2021-08-23 13:28:33 +05:30

43 lines
856 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace HQFPSWeapons.Demo
{
public class DemoInstructions : MonoBehaviour
{
[SerializeField]
private bool m_InstructionsEnabledOnStart = false;
[Space(3f)]
[SerializeField]
private Text m_MessageToggleText = null;
[SerializeField]
private GameObject m_InstructionsObject = null;
private bool m_InstructionsEnabled;
private void Awake()
{
m_InstructionsEnabled = m_InstructionsEnabledOnStart;
Refresh();
}
private void Update()
{
if(Input.GetKeyDown(KeyCode.F12))
{
m_InstructionsEnabled = !m_InstructionsEnabled;
Refresh();
}
}
private void Refresh()
{
m_InstructionsObject.gameObject.SetActive(m_InstructionsEnabled);
m_MessageToggleText.text = "Press F12 to " + (m_InstructionsEnabled ? "hide" : "show") + " the instructions.";
}
}
}