ํฌ์ŠคํŠธ

WitchMendokusai DevLog v0.0.4

WitchMendokusai DevLog v0.0.4

๐Ÿ“€ ๋จธ๋ฆฌ๋ง


v0.0.4์˜ ๋ชฉํ‘œ๋Š”, ๋ชจํ—˜๊ฐ€ ๊ธธ๋“œ Concept์„ ๋งŒ๋“œ๋Š” ๊ฒƒ.

๐Ÿ“€ ๋ชจํ—˜๊ฐ€ ๊ธธ๋“œ


  • VillageReputationExp, VillageReputationLevel GameStat ์ถ”๊ฐ€

๐Ÿ“€ UI


๐Ÿ’ฟ UIItemEquipPopup

Item ํš๋“ ์‹œ ๋œจ๋Š” Popup UI๋ฅผ ๊พธ๋ช„๋‹ค.

Item ํš๋“ ์‹œ ์ด์ „์— ๋„์šด Popup UI๊ฐ€ ์‚ฌ๋ผ์ง€์ง€ ์•Š๊ณ  ์ข€ ๋” ์˜ค๋ž˜ ์œ ์ง€๋˜๋„๋ก ๋งŒ๋“ค์—ˆ๋‹ค.
์—ฌ๋Ÿฌ Item์„ ์—ฐ์†์œผ๋กœ ๋จน์œผ๋ฉด ๊ณ„์† ์‚ฌ๋ฆฌ์ง€์ง€ ์•Š๊ณ  ์œ ์ง€๋˜๋Š” ์‹.

๋ฌผ๋ก  ํ™”๋ฉด์„ ๊ฝ‰ ์ฑ„์šฐ๋ฉด ์ข€ ์ด์ƒํ•˜๋‹ˆ, ํŠน์ • ์ˆ˜๋ฅผ ๋„˜์–ด๊ฐ€๋ฉด ๋ช‡ ๊ฐœ๋Š” ์‚ฌ๋ผ์ง€๋„๋ก ๋งŒ๋“ค์—ˆ๋‹ค.

Item ํš๋“ Pop ์—ฌ๋Ÿฌ ๊ฐœ๊ฐ€ ํ•œ ๋ฒˆ์— ํ™”๋ฉด ์˜ค๋ฅธ์ชฝ์— ๋– ์žˆ๋Š”๊ฒŒ, ๋ญ”๊ฐ€ ํš๋“ ํ”ผ๋“œ๋ฐฑ ์ƒ ์ข‹์€ ๊ฒƒ ๊ฐ™์•„์„œ ๊ทธ๋ ‡๊ฒŒ ๋งŒ๋“ค์—ˆ๋‹ค.

GamePix๋‹˜์ด ๋งŒ๋“ค๊ณ  ๊ณ„์‹œ๋Š” ๊ฒŒ์ž„์˜ Screenshot์„ ์ฐธ๊ณ ํ–ˆ๋‹ค.
DOTween์„ ์ด์šฉํ•ด์„œ ๊ตฌํ˜„ํ–ˆ๋‹ค.

๐Ÿ’ฟ UI Refactoring

UI ๊ตฌ์กฐ๋ฅผ Refactoring ํ–ˆ๋‹ค.

  • IUI -> UIBase (Interface -> Abstract Class)
  • UIBase.OnOpen() OnClose()
  • Init ๊ตฌ์กฐ ํ†ต์ผํ™” (๋งค๊ฐœ๋ณ€์ˆ˜ X, isInit X)
  • UIPanels Refactoring
  • UIUtil ์ถ”๊ฐ€ (CanvasGroup.SetVisible(~))
  • UICraftPanel ์ถ”๊ฐ€
  • UILayoutInitializer ์ถ”๊ฐ€
  • ์ผ๋ถ€ Prefab ์ถ”๊ฐ€
  • ์ผ๋ถ€ File/Folder ๊ณ„์ธต๊ตฌ์กฐ ๋ณ€๊ฒฝ
  • UIPanels
    • transform.GetChild <- ์ด๊ฒƒ๋„ ๋น„ํ™œ์„ฑํ™”๋œ GameObject ๋ชป ์ฐพ๋Š”์ง€ ๋ชฐ๋ž๋„ค
    • GetComponentsInChildren๋กœ ๊ธ์–ด์˜ค๊ณ , LINQ Select์œผ๋กœ transform.root๊ฐ€ ํ˜„์žฌ this.gameObject์ธ ๊ฒƒ๋งŒ ํ•„ํ„ฐ๋ง ํ–ˆ๋‹ค.

๋ฐ”๊พธ๋‹ˆ๊นŒ ์ œ๋Œ€๋กœ ๋™์ž‘ํ•˜์ง€ ์•Š๋Š” UI๋“ค์ด ๋งŽ์•˜๋‹ค.
๋‚ด๊ฐ€

๐Ÿ“€ Grid, Building


๊ฑด๋ฌผ ๋ฐฐ์น˜ ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค์—ˆ๋‹ค.
๊ฐ WorldStage ๋ณ„๋กœ ๊ฑด๋ฌผ์ด ๋‹ค๋ฅด๊ฒŒ ๋ฐฐ์น˜๋˜๊ธฐ ๋•Œ๋ฌธ์—, ์ €์žฅ ์ •๋ณด๋Š” WorldStage์— ์ €์žฅํ•˜๋„๋ก ํ–ˆ๋‹ค.

  • Grid -> Build / Building

WorldStage์— ์ง์ ‘ BuildingSaveData๋ฅผ ๋„ฃ์ง€๋Š” ์•Š์•˜๊ณ , WorldStageSaveData๋กœ ํ•œ ๋ฒˆ Wrapping ํ–ˆ๋‹ค.
๋‚˜์ค‘์— WorldStage์— ์ €์žฅ๋  ์ •๋ณด๊ฐ€ ๋” ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œ๋‹ค.

Grid ๊ธฐ๋Šฅ์— ์‚ฌ์šฉ๋œ Shader์™€ ์ดˆ๊ธฐ ๊ธฐ๋ฐ˜ ์ž‘์„ฑ์— โ€˜Sunny Valley Studioโ€™: โ€˜Grid Placement System in Unity 2022โ€™์„ ์ฐธ๊ณ ํ–ˆ๋‹ค.

์ฒ˜์Œ์—” Grid๋ฅผ ์‹ญ์ž ๋ชจ์–‘์˜ ๊ฒฉ์ž๋กœ ๋งŒ๋“ค์—ˆ๋Š”๋ฐ, Cult of The Lamb์˜ ๋Œ€๊ฐ ๋ชจ์–‘ Grid๊ฐ€ ์ด์œ ๊ฒƒ ๊ฐ™์•„ ๊ทธ๋ ‡๊ฒŒ ๋ฐ”๊ฟจ๋‹ค.

๐Ÿ“€ DataSOWindow


ScriptableObject๋“ค์„ ๊ด€๋ฆฌํ•˜๋Š” DataSOWindow CustomEditor.
๊ธฐ์กด์—๋Š” MDataSO ๋ผ๋Š” ์ด๋ฆ„์ด์—ˆ๋Š”๋ฐ, DataSOWindow๋กœ ๋ฐ”๊ฟจ๋‹ค.

๐Ÿ’ฟ DataSOUtil

์ƒˆ๋กœ Util Class๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// ์—์…‹ ๊ฒ€์ƒ‰ ์‹œ์ž‘
string[] guids = AssetDatabase.FindAssets("t:DataSO", new[] { BASE_DIR });

// ์ง„ํ–‰ ์ƒํ™ฉ ํ‘œ์‹œ
EditorUtility.DisplayProgressBar($"{taskName} ์ค‘", "DataSO ์—์…‹์„ ์ฒ˜๋ฆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค", 0f);

for (int i = 0; i < guids.Length; i++)
{
	string guid = guids[i];
	string path = AssetDatabase.GUIDToAssetPath(guid);
	DataSO dataSO = AssetDatabase.LoadAssetAtPath<DataSO>(path);
	// ...
	action.Invoke(dataSO);
	// ...
}

์œ„ ๊ฐ™์€ ๋‚ด์šฉ์„ ๊ฐ€์ง„ ForeachDataSO(Func<DataSO, bool> action) ์ด๋ผ๋Š” ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค.
๋ชจ๋“  DataSO Asset์„ ์ฐพ๊ณ , ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๋ฐ›์€ action์„ ์‹คํ–‰์‹œ์ผœ์ฃผ๋Š” ํ•จ์ˆ˜๋‹ค.

์ด ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•ด DataSO Asset์˜ Addressable Group๊ณผ Label์„ ์„ค์ •ํ•ด์ฃผ๋Š” SetupAllAddressables()์„ ์ƒˆ๋กœ ์ถ”๊ฐ€ํ–ˆ๊ณ ,
๊ธฐ์กด์— ๋งŒ๋“ค์–ด๋’€๋˜ SaveAssets(), InitDict() ๊ธฐ๋Šฅ๋„ ์ด ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜๋„๋ก ๋ฐ”๊ฟ”์คฌ๋‹ค.

DataSO Asset ๋ชฉ๋ก์„ ์ฐพ๊ธฐ ์œ„ํ•ด ๊ธฐ์กด์—๋Š” System.IO ๋ฅผ ์ด์šฉํ•ด ์ง์ ‘ File์„ ๊ฒฝ๋กœ๋ณ„๋กœ ์ฐพ์•„์„œ ๊ฐ DataSO๋ฅผ ์ฒ˜๋ฆฌํ–ˆ๋Š”๋ฐ,
AssetDatabase.FindAssets๋ฅผ ์ด์šฉํ•ด ํŠน์ • Type?์˜ File GUID๋ฅผ ํ•œ ๋ฒˆ์— ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์—ˆ๋‹ค.

  • DataSODefine ์ถ”๊ฐ€
  • MDataSO -> DataSOWindow
  • MDataSODetail -> DataSOInspector
  • Custom Inspector์—์„œ ํŠน์ • Field ๊ฐ’ ๋ณ€๊ฒฝ ์‹œ Asset์— SetDirty
  • InitDic() -> InitDict()
  • ํ•˜๋‚˜์˜ ํƒ€์ž…๋งŒ์„ ๋Œ€์ƒ์œผ๋กœ ํ•˜๋˜ InitDict๋ฅผ, ๋ชจ๋“  ํƒ€์ž…์— ๋Œ€์ƒ์œผ๋กœ ํ•˜๋„๋ก ์ˆ˜์ •
  • BadIdDataSO๊ฐ€ ๊ฐ Type๋ณ„๋กœ ์ •๋ณด๋ฅผ ๊ฐ€์ง€๋„๋ก List -> Dictionary<Type, List> ๋กœ Type ์ˆ˜์ •
  • DataSOWindow์˜ GetGoodName(), ConvertToGoodName()์„ DataSOUtil๋กœ ์ด๊ด€
  • DataSOUtil.GetBaseType() -> TryGetBaseType() ์ˆ˜์ •
  • ๋ชฉํ‘œ๋กœ ํ•˜์ง€ ์•Š๋Š” DataSO๋Š” SetupAllAddressables() Log Count์— ํฌํ•จํ•˜์ง€ ์•Š๋„๋ก ์ˆ˜์ •

๐Ÿ“€ DungeonConstraint ๋ฒ„๊ทธ ์ˆ˜์ •


Addressable๋กœ ๋ถˆ๋Ÿฌ์˜จ Dungeon๊ณผ, NPC๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” Dungeon์ด ์„œ๋กœ ๋งž์ง€ ์•Š์•„ ๋ฐœ์ƒํ–ˆ๋–ค ๋ฌธ์ œ

๐Ÿ“€ ๊ทธ ์™ธ


  • Nyang, VQExp๋ฅผ GameStat์— ๋ณ‘ํ•ฉ
    • Nyang, Mana, VillageQuestExp, VillageQuestLevel
  • SOHelper์— Enum ShortCut ์ถ”๊ฐ€
    • GetUnitStatData(), GetGameStatData(), GetDungeonStatData()
  • Canvas ์ •๋ฆฌ
  • File/Folder ๊ฒฝ๋กœ/๊ณ„์ธต๊ตฌ์กฐ ์ˆ˜์ •, Naming ์ˆ˜์ •
    • MDataSO -> DataSO
    • Datas => Data
    • Criterias => Criteria
  • System
    • DataLoad๋ฅผ ๋ชจ๋‘ ๋งˆ์นœ ํ›„ Login์„ ์‹œ๋„ํ•˜๋„๋ก ์ˆ˜์ • (๊ธฐ์กด์—๋Š” DataLoad ์—ฌ๋ถ€์™€ ์ƒ๊ด€์—†์ด Login์„ ์‹œ๋„ํ•จ)
    • DataLoad ์‹œ ํ˜„์žฌ Scene์ด Lobby๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ์—๋งŒ Lobby๋กœ ์ด๋™ํ•˜๋„๋ก ์ˆ˜์ •
    • DataLoad ์‹œ Image.fillAmount ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ Text๋กœ๋„ ์ •๋ณด๋ฅผ ์•Œ๋ ค์ฃผ๋„๋ก ์ˆ˜์ •
      • ๊ทผ๋ฐ ๋„ˆ๋ฌด ์งง์•„์„œ ์ž˜ ๋ณด์ด์ง„ ์•Š๋Š”๋‹ค.
    • GameSetting ์ˆ˜์ •, EditorSettings ์ถ”๊ฐ€
      • ์ปดํŒŒ์ผ ํ•  ๋•Œ๋งˆ๋‹ค DataSOWindow.InitDict()๊ฐ€ ์‹คํ–‰๋˜๋Š”๋ฐ, ์ข€ ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋Š” ๊ฒƒ ๊ฐ™์•„์„œ InitDict() ์‹คํ–‰ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค์—ˆ๋‹ค.
      • ๊ทผ๋ฐ ์ž˜ ์ฒด๊ฐ๋˜์ง€๋Š” ์•Š๋Š”๋‹ค.
  • ObjectPool
    • ObjectPool์—์„œ ์ƒ์„ฑ๋œ GameObject๋ฅผ ๊ณ„์ธต๊ตฌ์กฐ์—์„œ ์ •๋ฆฌ
      • ๊ณ„์ธต๊ตฌ์กฐ ์ฐฝ์— ObjectPool๋กœ ์ƒ์„ฑ๋œ GameObject๋“ค์ด ์ซ˜๋ผ๋ฝ ๋„๋ฐฐ๊ฐ€ ๋˜๋‹ˆ๊นŒ ๋ณด๊ธฐ๊ฐ€ ์ข€ ์•ˆ์ข‹์•„์„œ ์ˆ˜์ •ํ–ˆ๋‹ค.
    • Spawn Overloading ์ถ”๊ฐ€
      • Transform.SetParent ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ worldPositionStays๊ฐ€ ์žˆ๋Š”๋ฐ, ๊ธฐ์กด world ์ขŒํ‘œ ์œ ์ง€ ์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. default: true
  • DOTween Reimport

๐Ÿ“€ ๋‹ค์Œ


To Be Continued..

์ด ๊ธฐ์‚ฌ๋Š” ์ €์ž‘๊ถŒ์ž์˜ CC BY 4.0 ๋ผ์ด์„ผ์Šค๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค.