Files
Cielonos/Assets/Scripts/MainGame/Managers/BasePrefabsCollection.cs
SoulliesOfficial 33b1795c1f 更新
2026-01-03 18:19:39 -05:00

41 lines
1.4 KiB
C#

using System.Collections.Generic;
using Cielonos.MainGame.Inventory;
using DamageNumbersPro;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Cielonos.MainGame
{
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Cielonos/MainGame/BasePrefabsCollection")]
public partial class BasePrefabsCollection : SerializedScriptableObject
{
public GameObject audioPoint;
public Dictionary<string, DamageNumber> hudTextCollection;
public Dictionary<BreakthroughType, Color> outlineColorCollection;
public Dictionary<ItemRarity, Color> itemRarityColorCollection;
}
public partial class BasePrefabsCollection
{
public DamageNumber GetHudTextPrefab(AttackType attackType, bool isCritical)
{
string prefix = "DN";
string typeStr = attackType.ToString();
string criticalStr = isCritical ? "Critical" : "Normal";
string dnKey = $"{prefix}_{typeStr}_{criticalStr}";
if (hudTextCollection.TryGetValue(dnKey, out var hudTextPrefab))
{
return hudTextPrefab;
}
throw new KeyNotFoundException($"HUD Text Prefab with key '{dnKey}' not found in BasePrefabsCollection.");
}
public DamageNumber GetInfoTextPrefab()
{
return hudTextCollection.GetValueOrDefault("Info_Normal");
}
}
}