Net.Like.Xue.Tokyo/Packages-Local/Com.Project.B.Unity/Loot/ScriptableLoot.cs

28 lines
922 B
C#

using System.Collections;
using System.Collections.Frozen;
using System.Collections.Generic;
using AYellowpaper.SerializedCollections;
using BITKit;
using Project.B.Item;
using UnityEngine;
namespace Net.Project.B.Loot
{
public class ScriptableLoot : ScriptableObject,IScriptableLoot
{
[SerializeField] private int id;
[SerializeField] private int seed;
[SerializeReference, SubclassSelector] internal IReference lootName;
[SerializeReference, SubclassSelector] internal IWorldLootType lootType;
[SerializeField] internal SerializedDictionary<ScriptableItem, int> itemWeights;
public int Id => id;
public int Seed => seed;
public string Name => lootName?.Value;
public IReadOnlyDictionary<int, int> ItemWeights => itemWeights.ToFrozenDictionary(x=>x.Key.Id,x=>x.Value);
public IWorldLootType LootType => lootType;
}
}