Initial commit: Tiny Tackle Heroes Unity project
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BumpCombat.Constants
|
||||
{
|
||||
[CreateAssetMenu(menuName = "BumpCombat/Constants/Gameplay Catalog")]
|
||||
public sealed class GameplayConstants : ScriptableObject
|
||||
{
|
||||
private const string ResourcePath = "GameplayConstants";
|
||||
private static GameplayConstants current;
|
||||
private static PlayerConstants fallbackPlayer;
|
||||
private static CombatConstants fallbackCombat;
|
||||
private static EnemyConstants fallbackEnemies;
|
||||
private static ItemConstants fallbackItems;
|
||||
private static LevelUpConstants fallbackLevelUp;
|
||||
private static ArtifactConstants fallbackArtifacts;
|
||||
private static RunConstants fallbackRun;
|
||||
private static CombatFeedbackSettings fallbackCombatFeedback;
|
||||
|
||||
[Header("설정 분류")]
|
||||
[SerializeField, Tooltip("플레이어 기본 능력치, 피격, 가드 설정")]
|
||||
private PlayerConstants player;
|
||||
[SerializeField, Tooltip("몸통박치기 판정과 피해 설정")]
|
||||
private CombatConstants combat;
|
||||
[SerializeField, Tooltip("적 행동과 적 공통 설정")]
|
||||
private EnemyConstants enemies;
|
||||
[SerializeField, Tooltip("아이템과 경험치 구슬 설정")]
|
||||
private ItemConstants items;
|
||||
[SerializeField, Tooltip("경험치, 레벨업, 미션 설정")]
|
||||
private LevelUpConstants levelUp;
|
||||
[SerializeField, Tooltip("아티팩트 게이지와 공통 실행 설정")]
|
||||
private ArtifactConstants artifacts;
|
||||
[SerializeField, Tooltip("런 시간표, 스폰, 전장 설정")]
|
||||
private RunConstants run;
|
||||
[SerializeField, Tooltip("타격, 피격, 가드 효과의 표시 설정")]
|
||||
private CombatFeedbackSettings combatFeedback;
|
||||
|
||||
public static GameplayConstants Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (current == null)
|
||||
{
|
||||
current = Resources.Load<GameplayConstants>(ResourcePath);
|
||||
if (current == null)
|
||||
{
|
||||
current = CreateInstance<GameplayConstants>();
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerConstants Player => Resolve(player, ref fallbackPlayer);
|
||||
public CombatConstants Combat => Resolve(combat, ref fallbackCombat);
|
||||
public EnemyConstants Enemies => Resolve(enemies, ref fallbackEnemies);
|
||||
public ItemConstants Items => Resolve(items, ref fallbackItems);
|
||||
public LevelUpConstants LevelUp => Resolve(levelUp, ref fallbackLevelUp);
|
||||
public ArtifactConstants Artifacts => Resolve(artifacts, ref fallbackArtifacts);
|
||||
public RunConstants Run => Resolve(run, ref fallbackRun);
|
||||
public CombatFeedbackSettings CombatFeedback =>
|
||||
Resolve(combatFeedback, ref fallbackCombatFeedback);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static void SetCurrentForTests(GameplayConstants value)
|
||||
{
|
||||
current = value;
|
||||
}
|
||||
|
||||
public static void ResetCurrentForTests()
|
||||
{
|
||||
current = null;
|
||||
fallbackPlayer = null;
|
||||
fallbackCombat = null;
|
||||
fallbackEnemies = null;
|
||||
fallbackItems = null;
|
||||
fallbackLevelUp = null;
|
||||
fallbackArtifacts = null;
|
||||
fallbackRun = null;
|
||||
fallbackCombatFeedback = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
private static T Resolve<T>(T value, ref T fallback) where T : ScriptableObject
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (fallback == null)
|
||||
{
|
||||
fallback = CreateInstance<T>();
|
||||
}
|
||||
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user