You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.3 KiB
73 lines
1.3 KiB
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class PlacementObject : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private bool IsSelected;
|
|
|
|
[SerializeField]
|
|
private bool IsLocked;
|
|
|
|
public bool Selected
|
|
{
|
|
get
|
|
{
|
|
return this.IsSelected;
|
|
}
|
|
set
|
|
{
|
|
IsSelected = value;
|
|
}
|
|
}
|
|
|
|
public bool Locked
|
|
{
|
|
get
|
|
{
|
|
return this.IsLocked;
|
|
}
|
|
set
|
|
{
|
|
IsLocked = value;
|
|
}
|
|
}
|
|
|
|
[SerializeField]
|
|
private TextMeshPro OverlayText;
|
|
|
|
[SerializeField]
|
|
private Canvas canvasComponent;
|
|
|
|
[SerializeField]
|
|
private string OverlayDisplayText;
|
|
|
|
public void SetOverlayText(string text)
|
|
{
|
|
if (OverlayText != null)
|
|
{
|
|
OverlayText.gameObject.SetActive(true);
|
|
OverlayText.text = text;
|
|
}
|
|
}
|
|
|
|
void Awake()
|
|
{
|
|
OverlayText = GetComponentInChildren<TextMeshPro>();
|
|
if (OverlayText != null)
|
|
{
|
|
OverlayText.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void ToggleOverlay()
|
|
{
|
|
OverlayText.gameObject.SetActive(IsSelected);
|
|
OverlayText.text = OverlayDisplayText;
|
|
}
|
|
|
|
public void ToggleCanvas()
|
|
{
|
|
canvasComponent?.gameObject.SetActive(IsSelected);
|
|
}
|
|
}
|