using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using Unity.Netcode;
using UnityEngine;

public class UIZDisabler : MonoBehaviour
{
    [Tooltip("Keep enabled if is [BLANK]")]
    public KeepIf KeepEnabledIf = KeepIf.IsHost;
    [SerializeField] private GameObject target;

    private void OnEnable()
    {
        if (NetworkManager.Singleton == null) return;

        if (KeepEnabledIf == KeepIf.IsHost && NetworkManager.Singleton.IsHost) return;

        if (KeepEnabledIf == KeepIf.IsJoin && !NetworkManager.Singleton.IsHost) return;

        target.SetActive(false);
    }

    // Keep enabled if is [blank]
    public enum KeepIf
    {
        IsHost,
        IsJoin
    }
}