using UnityEngine; namespace Ashwild.Cooking { /// /// One cooking spot on a CookingStation: a pure visual anchor. It only shows or clears the /// food model snapped to its Transform. All cooking state and timing now live on the /// (server-authoritative) station, which drives this slot from replicated state. /// [DisallowMultipleComponent] public class CookingSlot : MonoBehaviour { #region State /// /// The food model currently shown on this slot, if any. /// private GameObject visual; #endregion #region Public API /// /// Shows a fresh model instance snapped to this slot, replacing any previous one. Its /// colliders are disabled so the food never steals the interaction ray from the station. /// A null prefab simply clears the slot. /// public void ShowModel(GameObject prefab) { ClearModel(); if (prefab == null) return; visual = Instantiate(prefab, transform); visual.transform.localPosition = Vector3.zero; visual.transform.localRotation = Quaternion.identity; Collider[] cols = visual.GetComponentsInChildren(); for (int i = 0; i < cols.Length; i++) cols[i].enabled = false; } /// /// Removes the current model instance if one is shown. /// public void ClearModel() { if (visual != null) { Destroy(visual); visual = null; } } #endregion } }