added: item pickups with online persistency

This commit is contained in:
Chris
2025-09-08 16:40:13 -04:00
parent 8bdf0b31cc
commit 7a0499f36a
39 changed files with 8228 additions and 208 deletions

View File

@@ -0,0 +1,38 @@
using System;
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(){
}
// 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);
}
}
}