2026.06.29

This commit is contained in:
2026-06-29 14:25:49 +09:00
parent 68bfddf8c7
commit f67d0683a0
257 changed files with 23935 additions and 998 deletions

View File

@@ -8,7 +8,7 @@ public class FishingRewardSystem : MonoBehaviour
public class LootEntry
{
public FishingItemType itemType = FishingItemType.Fish;
public string displayName = "생선";
public string displayName = "물고기";
[Min(0f)] public float weight = 1f;
public LootEntry(FishingItemType itemType, string displayName, float weight)
@@ -36,11 +36,11 @@ public CatchResult(FishingItemType itemType, string displayName, bool countsAsCl
}
[Header("Loot Table - Dirty Pond")]
[Tooltip("연못이 정화되기 전 낚이는 아이템 목록입니다. 기억의 조각은 이 테이블에 있어도 자동 제외됩니다.")]
[Tooltip("연못이 정화되기 전에는 물고기와 쓰레기만 낚입니다. 기억의 조각은 자동 제외됩니다.")]
[SerializeField] private List<LootEntry> dirtyPondLootTable = new List<LootEntry>();
[Header("Loot Table - Clean Pond")]
[Tooltip("연못이 정화된 뒤 낚이는 아이템 목록입니다. 기억의 조각을 포함할 수 있습니다.")]
[Tooltip("연못이 정화된 뒤에는 기억의 조각이 낚입니다.")]
[SerializeField] private List<LootEntry> cleanPondLootTable = new List<LootEntry>();
[Header("Debug")]
@@ -74,6 +74,10 @@ private void EnsureLootTables()
if (cleanPondLootTable == null)
cleanPondLootTable = new List<LootEntry>();
// 이전 버전의 상한 생선/병/봉지/나침반 등이 인스펙터에 남아 있어도
// 런타임에서는 물고기 / 쓰레기 / 기억의 조각 3종만 남도록 정리합니다.
SanitizeLootTables();
if (dirtyPondLootTable.Count == 0)
SetDefaultDirtyLootTable();
@@ -81,6 +85,45 @@ private void EnsureLootTables()
SetDefaultCleanLootTable();
}
private void SanitizeLootTables()
{
SanitizeTable(dirtyPondLootTable, allowFish: true, allowTrash: true, allowMemoryPiece: false);
SanitizeTable(cleanPondLootTable, allowFish: false, allowTrash: false, allowMemoryPiece: true);
}
private void SanitizeTable(List<LootEntry> table, bool allowFish, bool allowTrash, bool allowMemoryPiece)
{
if (table == null)
return;
for (int i = table.Count - 1; i >= 0; i--)
{
LootEntry entry = table[i];
if (entry == null || !IsAllowedInTable(entry.itemType, allowFish, allowTrash, allowMemoryPiece))
table.RemoveAt(i);
}
}
private bool IsAllowedInTable(FishingItemType itemType, bool allowFish, bool allowTrash, bool allowMemoryPiece)
{
switch (itemType)
{
case FishingItemType.Fish:
return allowFish;
case FishingItemType.Trash:
return allowTrash;
case FishingItemType.MemoryPiece:
return allowMemoryPiece;
case FishingItemType.None:
default:
return false;
}
}
private void SetDefaultLootTables()
{
SetDefaultDirtyLootTable();
@@ -91,13 +134,8 @@ private void SetDefaultDirtyLootTable()
{
dirtyPondLootTable = new List<LootEntry>
{
new LootEntry(FishingItemType.Fish, "생선", 25f),
new LootEntry(FishingItemType.RottenFish, "상한 생선", 8f),
new LootEntry(FishingItemType.Trash, "쓰레기", 28f),
new LootEntry(FishingItemType.Bottle, "병", 18f),
new LootEntry(FishingItemType.PlasticBag, "봉지", 18f),
new LootEntry(FishingItemType.JellyfishPowder, "해파리 가루", 6f),
new LootEntry(FishingItemType.OldCompass, "낡은 나침반", 4f)
new LootEntry(FishingItemType.Fish, "물고기", 35f),
new LootEntry(FishingItemType.Trash, "쓰레기", 65f)
};
}
@@ -105,11 +143,7 @@ private void SetDefaultCleanLootTable()
{
cleanPondLootTable = new List<LootEntry>
{
new LootEntry(FishingItemType.MemoryPiece, "기억의 조각", 30f),
new LootEntry(FishingItemType.Fish, "생선", 30f),
new LootEntry(FishingItemType.OldCompass, "낡은 나침반", 15f),
new LootEntry(FishingItemType.JellyfishPowder, "해파리 가루", 15f),
new LootEntry(FishingItemType.RottenFish, "상한 생선", 4f)
new LootEntry(FishingItemType.MemoryPiece, "기억의 조각", 100f)
};
}
@@ -122,14 +156,14 @@ private void ClampLootTable(List<LootEntry> table)
{
if (table[i] == null)
{
table[i] = new LootEntry(FishingItemType.Fish, "생선", 1f);
table[i] = new LootEntry(FishingItemType.Fish, "물고기", 1f);
continue;
}
table[i].weight = Mathf.Max(0f, table[i].weight);
if (string.IsNullOrWhiteSpace(table[i].displayName))
table[i].displayName = GetDefaultDisplayName(table[i].itemType);
// 이전 버전에서 남은 표시 이름을 3종 아이템 이름으로 정리합니다.
table[i].displayName = GetDefaultDisplayName(table[i].itemType);
}
}
@@ -142,7 +176,8 @@ public CatchResult RollCatch(bool pondCleaned, bool forceMemoryPiece)
LootEntry selectedEntry = RollFromTable(table, pondCleaned);
if (selectedEntry == null)
return CreateCatchResult(FishingItemType.Fish, GetDefaultDisplayName(FishingItemType.Fish));
return CreateCatchResult(pondCleaned ? FishingItemType.MemoryPiece : FishingItemType.Fish,
GetDefaultDisplayName(pondCleaned ? FishingItemType.MemoryPiece : FishingItemType.Fish));
return CreateCatchResult(selectedEntry.itemType, selectedEntry.displayName);
}
@@ -194,10 +229,15 @@ private bool IsRollableEntry(LootEntry entry, bool pondCleaned)
if (entry.weight <= 0f)
return false;
if (entry.itemType == FishingItemType.None)
return false;
if (!pondCleaned && entry.itemType == FishingItemType.MemoryPiece)
return false;
return entry.itemType != FishingItemType.None;
return entry.itemType == FishingItemType.Fish ||
entry.itemType == FishingItemType.Trash ||
entry.itemType == FishingItemType.MemoryPiece;
}
private CatchResult CreateCatchResult(FishingItemType itemType, string displayName)
@@ -214,9 +254,7 @@ private CatchResult CreateCatchResult(FishingItemType itemType, string displayNa
public bool IsCleanupItem(FishingItemType itemType)
{
return itemType == FishingItemType.Trash ||
itemType == FishingItemType.Bottle ||
itemType == FishingItemType.PlasticBag;
return itemType == FishingItemType.Trash;
}
public string GetDefaultDisplayName(FishingItemType itemType)
@@ -224,26 +262,11 @@ public string GetDefaultDisplayName(FishingItemType itemType)
switch (itemType)
{
case FishingItemType.Fish:
return "생선";
case FishingItemType.RottenFish:
return "상한 생선";
return "물고기";
case FishingItemType.Trash:
return "쓰레기";
case FishingItemType.Bottle:
return "병";
case FishingItemType.PlasticBag:
return "봉지";
case FishingItemType.JellyfishPowder:
return "해파리 가루";
case FishingItemType.OldCompass:
return "낡은 나침반";
case FishingItemType.MemoryPiece:
return "기억의 조각";