36 lines
876 B
C#
36 lines
876 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ToggleUIObjects : MonoBehaviour
|
|
{
|
|
public GameObject escToggleNoBuild;
|
|
|
|
bool isActive;
|
|
void Start()
|
|
{
|
|
isActive = false;
|
|
|
|
if (escToggleNoBuild != null)
|
|
escToggleNoBuild.SetActive(isActive);
|
|
else
|
|
Debug.LogWarning(escToggleNoBuild + "not assigned");
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (!GameManager.Instance.IsBuildMode && Input.GetKeyDown(KeyCode.Escape))
|
|
{
|
|
isActive = !isActive;
|
|
}
|
|
if(GameManager.Instance.IsBuildMode && Input.GetKeyDown(KeyCode.Escape))
|
|
{
|
|
isActive = false;
|
|
}
|
|
if (escToggleNoBuild != null)
|
|
escToggleNoBuild.SetActive(isActive);
|
|
else
|
|
Debug.LogWarning(escToggleNoBuild + "not assigned");
|
|
}
|
|
}
|