using UnityEngine; public class Building : MonoBehaviour { [Header("Building Settings")] public string buildingName = "Building"; public string displayName; public bool canEnter = true; [Header("Entry Point")] public Transform entryPoint; // where the player should move to [Header("Visuals")] public GameObject highlightObject; // optional: enable when selected public Attitude attitude = Attitude.Neutral; public Gate gate; void OnValidate() { if (string.IsNullOrEmpty(displayName)) displayName = buildingName; } public void OnSelected() { if (highlightObject != null) highlightObject.SetActive(true); } public void OnDeselected() { if (highlightObject != null) highlightObject.SetActive(false); } public bool TryEnter() { if (!canEnter) return false; if (gate != null) { if (gate.isLocked) return false; // Ensure gate is open before entering gate.Open(); } // perform enter logic (teleport, scene change, UI) Enter(); return true; } public void Enter() { if (!canEnter) return; Debug.Log($"Entering {buildingName}"); // Add logic here: fade out, teleport player, open interior scene, etc. } }