更新
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame.Inventory;
|
||||
using DamageNumbersPro;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
@@ -6,11 +7,35 @@ using UnityEngine;
|
||||
namespace Cielonos.MainGame
|
||||
{
|
||||
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Cielonos/MainGame/BasePrefabsCollection")]
|
||||
public class BasePrefabsCollection : SerializedScriptableObject
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user