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,7 @@
using UnityEngine;
namespace Reset.Items{
public class Ability : Item, IEquipable{
public NodeCanvas.Framework.Graph behaviourGraph;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: faa811a7ade12ef44b5e4d2065b28401

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78ad34c56119132409b8757bdf2fbd98
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
using UnityEngine;
public interface IEquipable
{
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a09cb950a163e5c49bddf8d6c2187148

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;
namespace Reset.Items{
public abstract class Item : ScriptableObject{
public string itemName{ get; set; }
public float permanency;
public float essenceRequiredForPermanency;
private Event onDropDelegates;
public void DropItem(){
}
public virtual ItemDrop CreateItemDropFrom(){
ItemDrop newItemDrop = new GameObject().AddComponent<ItemDrop>();
newItemDrop.item = this;
return newItemDrop;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ae19a9c5003b14c4d9d8a23d3278be2e

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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 47fcfe0cd0436de41a99c2ed60f488a8

View File

@@ -0,0 +1,15 @@
using System;
using NodeCanvas.StateMachines;
using UnityEngine;
namespace Reset.Items{
[CreateAssetMenu(menuName = "Reset/Weapon", fileName = "New Weapon")]
public class Weapon : Item, IEquipable{
public GameObject weaponModel;
public NodeCanvas.Framework.Graph weaponFSM;
void Awake(){
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b7f2c6caae048f64f91b54ae1442694c