更改文件架构
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "BITKit.ObjectMaterial",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:a209c53514018594f9f482516f2a6781",
|
||||
"GUID:274d4ecae4648e94c8b2cee7218378a0",
|
||||
"GUID:66d2ae14764cc7d49aad4b16930747c0",
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:9400d40641bab5b4a9702f65bf5c6eb5"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"ODIN_INSPECTOR"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b1d74e3b694cde47b6e3e0bc0cb18e7
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace BITKit.ObjectMaterial
|
||||
{
|
||||
public class GetObjectMaterialByCollider : MonoBehaviour, IObjectMaterial
|
||||
{
|
||||
public ObjectMaterialScriptableObject material;
|
||||
public ObjectMaterialInfo GetObjectMaterial(string action = "None", Vector3 pos = default)
|
||||
{
|
||||
return material.dictionary[action];
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d163a466769908479135a6c230a07bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using RotaryHeart.Lib.SerializableDictionary;
|
||||
namespace BITKit.ObjectMaterial
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct ObjectMaterialInfo
|
||||
{
|
||||
public AudioSO[] clips;
|
||||
public Transform[] prefabs;
|
||||
public AudioSO GetAudioSO() => clips.Random();
|
||||
public Transform GetPrefab() => prefabs.Random();
|
||||
}
|
||||
public interface IObjectMaterial
|
||||
{
|
||||
ObjectMaterialInfo GetObjectMaterial(string action = "None", Vector3 pos = default);
|
||||
}
|
||||
public class ObjectMaterialScriptableObject : BITKitSO
|
||||
{
|
||||
|
||||
[Header(Constant.Header.Settings)]
|
||||
public new string name;
|
||||
[Header(Constant.Header.Prefabs)]
|
||||
public SerializableDictionaryBase<string, ObjectMaterialInfo> dictionary = new();
|
||||
|
||||
public override void RegisterAssets()
|
||||
{
|
||||
Data.Set<ObjectMaterialScriptableObject>(name, this);
|
||||
dictionary.Values.ForEach(x =>
|
||||
{
|
||||
x.clips.ForEach(x =>
|
||||
{
|
||||
Data.Set<AudioSO>(x.name, x);
|
||||
});
|
||||
x.prefabs.ForEach(x=>
|
||||
{
|
||||
Data.Set<Transform>(x.name,x);
|
||||
});
|
||||
});
|
||||
}
|
||||
public ObjectMaterialInfo Get(string name)=>dictionary[name];
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aec8115f9b59f1042b8bb7842c9da232
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user