using System; using Drawing; using Unity.Netcode; using UnityEngine; namespace Reset.Items{ public class ItemDrop : NetworkBehaviour, IInteractable{ public Item item; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start(){ if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) { GetComponent().Spawn(); } } // Update is called once per frame void Update(){ } public void Interact(){ if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) { Debug.Log("RPC Sent"); DestroyOnOwnerRpc(); } else { Debug.Log("Destroyed"); Destroy(gameObject); } } public void CancelInteract(){ throw new NotImplementedException(); } [Rpc(SendTo.Owner)] public void DestroyOnOwnerRpc(){ Destroy(gameObject); } public void OnObserverDetected(EnvironmentObserver observer){ Draw.ingame.Label2D(transform.position + Vector3.up * 2f, item.itemName, 24); item.DrawItemInfo(transform.position); } } }