added: loot containers

This commit is contained in:
Chris
2025-09-09 17:58:52 -04:00
parent f4cb569768
commit a0313798fd
16 changed files with 16639 additions and 72 deletions

View File

@@ -24,3 +24,8 @@ MonoBehaviour:
SourcePrefabToOverride: {fileID: 0} SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0 SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0} OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 164825482655611750, guid: 135c5b2038f9af24da4cb9260381bab7, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}

View File

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

View File

@@ -0,0 +1,141 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GlassMat
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- MOTIONVECTORS
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 1
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.7688679, g: 0.9094787, b: 1, a: 0.42745098}
- _Color: {r: 0.76886797, g: 0.9094787, b: 1, a: 0.42745098}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &4493835573570288372
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1dca118a1efeed74a833e96aa912810d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 135c5b2038f9af24da4cb9260381bab7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!134 &13400000
PhysicsMaterial:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ItemDropPhysics
serializedVersion: 2
m_DynamicFriction: 14.92
m_StaticFriction: 0.2
m_Bounciness: 1
m_FrictionCombine: 0
m_BounceCombine: 3

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ffa6cf73e7c18f4799941a5e9b779a3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 13400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -31,7 +31,7 @@ Transform:
m_GameObject: {fileID: 2439326541263862202} m_GameObject: {fileID: 2439326541263862202}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@@ -85,8 +85,8 @@ Rigidbody:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2439326541263862202} m_GameObject: {fileID: 2439326541263862202}
serializedVersion: 5 serializedVersion: 5
m_Mass: 1 m_Mass: 5.4
m_LinearDamping: 0 m_LinearDamping: 1.82
m_AngularDamping: 0.05 m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0} m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1} m_InertiaTensor: {x: 1, y: 1, z: 1}
@@ -165,7 +165,7 @@ MonoBehaviour:
ShowTopMostFoldoutHeaderGroup: 1 ShowTopMostFoldoutHeaderGroup: 1
NetworkRigidbodyBaseExpanded: 0 NetworkRigidbodyBaseExpanded: 0
UseRigidBodyForMotion: 0 UseRigidBodyForMotion: 0
AutoUpdateKinematicState: 1 AutoUpdateKinematicState: 0
AutoSetKinematicOnDespawn: 0 AutoSetKinematicOnDespawn: 0
--- !u!135 &-6903864654045134960 --- !u!135 &-6903864654045134960
SphereCollider: SphereCollider:
@@ -174,7 +174,7 @@ SphereCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2439326541263862202} m_GameObject: {fileID: 2439326541263862202}
m_Material: {fileID: 0} m_Material: {fileID: 13400000, guid: 8ffa6cf73e7c18f4799941a5e9b779a3, type: 2}
m_IncludeLayers: m_IncludeLayers:
serializedVersion: 2 serializedVersion: 2
m_Bits: 0 m_Bits: 0
@@ -186,7 +186,7 @@ SphereCollider:
m_ProvidesContacts: 0 m_ProvidesContacts: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 serializedVersion: 3
m_Radius: 0.5 m_Radius: 0.32
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &9131744606799350632 --- !u!1 &9131744606799350632
GameObject: GameObject:
@@ -216,7 +216,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.65529, y: 0.65529, z: 0.65529}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 8885804641608089777} m_Father: {fileID: 8885804641608089777}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections;
using Reset.Core.Tools;
using Sirenix.OdinInspector;
using Unity.Netcode;
using UnityEngine;
using Random = UnityEngine.Random;
namespace Reset.Items{
public class ItemContainer : NetworkBehaviour, IInteractable{
private bool available = true;
public GameObject itemDrop;
public int minItemsToSpawn;
public int maxItemsToSpawn;
public float cooldown;
public GameObject spawnPoint;
public Vector3 spawnRotationAngle;
public float spawnForce;
// 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(){
}
[Button]
public void Interact(){
if (available){
StartCoroutine(SpawnItems());
}
available = false;
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
SetAvailabilityRpc(false);
}
}
IEnumerator SpawnItems(){
for (int i = 0; i < Random.Range(minItemsToSpawn, maxItemsToSpawn); i++) {
GameObject newDrop = Instantiate(itemDrop);
newDrop.transform.position = spawnPoint.transform.position;
newDrop.AddComponent<ItemDrop>();
Vector3 randomSpawnDirection = new Vector3(
Random.Range(-spawnRotationAngle.x, spawnRotationAngle.x),
Random.Range(-spawnRotationAngle.y, spawnRotationAngle.y),
Random.Range(-spawnRotationAngle.z, spawnRotationAngle.z)
);
Vector3 outputSpawnDirection = Quaternion.Euler(randomSpawnDirection) * spawnPoint.transform.forward;
// outputSpawnDirection = transform.TransformDirection(outputSpawnDirection);
DebugOverlayDrawer.ChangeValue("ItemContainer", "Last Random Spawn Direction", randomSpawnDirection);
DebugOverlayDrawer.ChangeValue("ItemContainer", "Output Spawn Direction", outputSpawnDirection);
newDrop.GetComponent<Rigidbody>().AddForce(outputSpawnDirection * spawnForce, ForceMode.VelocityChange);
yield return new WaitForSeconds(.2f);
}
StartCoroutine(WaitForCooldown());
}
IEnumerator WaitForCooldown(){
yield return new WaitForSeconds(cooldown);
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
SetAvailabilityRpc(true);
}
available = true;
}
public void CancelInteract(){
throw new NotImplementedException();
}
[Rpc(SendTo.Everyone)]
void SetAvailabilityRpc(bool isAvailable){
Debug.Log($"I made this {isAvailable}!");
available = isAvailable;
}
public void OnObserverDetected(EnvironmentObserver observer){
return;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4ef1a4907f7107d4db5a3f19fc18a94b

View File

@@ -9,14 +9,16 @@ namespace Reset.Items{
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start(){ void Start(){
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
GetComponent<NetworkObject>().Spawn();
}
} }
// Update is called once per frame // Update is called once per frame
void Update(){ void Update(){
} }
public void Interact(){ public void Interact(){
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient) {
Debug.Log("RPC Sent"); Debug.Log("RPC Sent");

View File

@@ -0,0 +1,5 @@
namespace Reset.Items{
public static class ItemUtilities{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1b888169dac844aea6cccec5726cebde
timeCreated: 1757367627

File diff suppressed because one or more lines are too long