BITKit/Packages/Runtime~/Unity/Scripts/ObjectMaterial/ObjectMaterialScriptableObj...

28 lines
907 B
C#

using System.Collections;
using System.Collections.Generic;
using AYellowpaper.SerializedCollections;
using UnityEngine;
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 : ScriptableObject
{
[Header(Constant.Header.Settings)]
public new string name;
[Header(Constant.Header.Prefabs)]
public SerializedDictionary<string, ObjectMaterialInfo> dictionary = new();
public ObjectMaterialInfo Get(string _name)=>dictionary[_name];
}
}