아이템 테이블 변경 및 추가

This commit is contained in:
NTG 2024-04-17 23:56:29 +09:00
parent 156722ad59
commit 8ef6f5fa43
25 changed files with 733 additions and 87 deletions

View File

@ -15,19 +15,13 @@ MonoBehaviour:
itemInstanceList:
- <Item>k__BackingField: {fileID: 11400000, guid: b6bf3a02ded696840a990636e2151830,
type: 2}
<Ratio>k__BackingField: 50
<Count>k__BackingField: {x: 1, y: 1}
<Probability>k__BackingField: 80
<Count>k__BackingField: {x: 1, y: 100}
prefab: {fileID: 4185765918994780331, guid: 0bb294b26cbcae54a8508211b077a88d,
type: 3}
- <Item>k__BackingField: {fileID: 11400000, guid: b60d264f0506e60469c4ad5cffb8c6ba,
type: 2}
<Ratio>k__BackingField: 30
<Count>k__BackingField: {x: 1, y: 1}
prefab: {fileID: 4185765918994780331, guid: 0bb294b26cbcae54a8508211b077a88d,
type: 3}
- <Item>k__BackingField: {fileID: 11400000, guid: 53c414221cf3e8b4f851d61aead8fd50,
type: 2}
<Ratio>k__BackingField: 20
<Probability>k__BackingField: 20
<Count>k__BackingField: {x: 1, y: 1}
prefab: {fileID: 4185765918994780331, guid: 0bb294b26cbcae54a8508211b077a88d,
type: 3}

View File

@ -15,13 +15,13 @@ MonoBehaviour:
itemInstanceList:
- <Item>k__BackingField: {fileID: 11400000, guid: b6bf3a02ded696840a990636e2151830,
type: 2}
<Ratio>k__BackingField: 75
<Count>k__BackingField: {x: 1, y: 1}
<Probability>k__BackingField: 80
<Count>k__BackingField: {x: 1, y: 100}
prefab: {fileID: 4185765918994780331, guid: 8ab179a0b6cfa1740a787520a9d2c722,
type: 3}
- <Item>k__BackingField: {fileID: 11400000, guid: b60d264f0506e60469c4ad5cffb8c6ba,
type: 2}
<Ratio>k__BackingField: 25
<Probability>k__BackingField: 20
<Count>k__BackingField: {x: 1, y: 1}
prefab: {fileID: 4185765918994780331, guid: 8ab179a0b6cfa1740a787520a9d2c722,
type: 3}

View File

@ -15,13 +15,13 @@ MonoBehaviour:
itemInstanceList:
- <Item>k__BackingField: {fileID: 11400000, guid: b6bf3a02ded696840a990636e2151830,
type: 2}
<Ratio>k__BackingField: 75
<Count>k__BackingField: {x: 1, y: 1}
<Probability>k__BackingField: 80
<Count>k__BackingField: {x: 1, y: 100}
prefab: {fileID: 4185765918994780331, guid: 0bb294b26cbcae54a8508211b077a88d,
type: 3}
- <Item>k__BackingField: {fileID: 11400000, guid: b60d264f0506e60469c4ad5cffb8c6ba,
type: 2}
<Ratio>k__BackingField: 25
<Probability>k__BackingField: 20
<Count>k__BackingField: {x: 1, y: 1}
prefab: {fileID: 4185765918994780331, guid: 0bb294b26cbcae54a8508211b077a88d,
type: 3}

View File

@ -1,22 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6864b0bdcf8edb441bea59200141b76b, type: 3}
m_Name: 500Coin
m_EditorClassIdentifier:
id: Currency002
name: "500\uCF54\uC778"
icon: {fileID: 21300000, guid: d06e32d389f004b02b646c7e8967d1e6, type: 3}
description:
price: 500
weight: 0
rarity: 0
prefab: {fileID: 4185765918994780331, guid: cded349812c1d624d9cc649e63d1b868, type: 3}

View File

@ -10,13 +10,12 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6864b0bdcf8edb441bea59200141b76b, type: 3}
m_Name: 100Coin
m_Name: Coin
m_EditorClassIdentifier:
id: Currency001
name: "100\uCF54\uC778"
name: "\uB3D9\uC804"
icon: {fileID: 21300000, guid: 1e68d32ca9d274421aa1325f2e9fc380, type: 3}
description:
price: 100
description: "\uB3D9\uC804\uC785\uB2C8\uB2E4."
price: 1
weight: 0
rarity: 0
prefab: {fileID: 4185765918994780331, guid: cded349812c1d624d9cc649e63d1b868, type: 3}

View File

@ -10,13 +10,12 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6864b0bdcf8edb441bea59200141b76b, type: 3}
m_Name: 1000Coin
m_Name: TreasureBox
m_EditorClassIdentifier:
id: Currency003
name: "1000\uCF54\uC778"
id: Currency002
name: "\uBCF4\uBB3C\uC0C1\uC790"
icon: {fileID: 21300000, guid: 42166f232ee914f4997bc503de7c4ab7, type: 3}
description:
description: "\uBCF4\uBB3C\uC0C1\uC790\uC785\uB2C8\uB2E4."
price: 1000
weight: 0
rarity: 0
prefab: {fileID: 4185765918994780331, guid: cded349812c1d624d9cc649e63d1b868, type: 3}
weight: 10
rarity: 1

View File

@ -10,36 +10,49 @@ namespace BlueWaterProject
{
public List<ItemInstance> itemInstanceList = new();
private ItemInstance PickItem()
{
var count = itemInstanceList.Count;
if (count == 0) return null;
var sumRatio = itemInstanceList.Sum(element => element.Ratio);
var randomRatio = Random.Range(0, sumRatio);
for (var i = 0; i < count; i++)
{
randomRatio -= itemInstanceList[i].Ratio;
if (randomRatio < 0)
{
return itemInstanceList[i];
}
}
return null;
}
// private ItemInstance PickItem()
// {
// var count = itemInstanceList.Count;
//
// if (count == 0) return null;
//
// var sumRatio = itemInstanceList.Sum(element => element.Probability);
// var randomRatio = Random.Range(0, sumRatio);
//
// for (var i = 0; i < count; i++)
// {
// randomRatio -= itemInstanceList[i].Probability;
//
// if (randomRatio < 0)
// {
// return itemInstanceList[i];
// }
// }
//
// return null;
// }
//
// public void ItemDrop(Vector3 dropPosition)
// {
// var dropItem = PickItem();
// if (dropItem == null) return;
//
// var dropCount = Random.Range((int)dropItem.Count.x, (int)dropItem.Count.y + 1);
// var instantiateItem = dropItem.Item.InstantiateItem(dropItem.prefab, dropPosition);
// instantiateItem.GetComponentInChildren<DropItemController>().Init(dropItem, dropCount);
// }
public void ItemDrop(Vector3 dropPosition)
{
var dropItem = PickItem();
if (dropItem == null) return;
var dropCount = Random.Range((int)dropItem.Count.x, (int)dropItem.Count.y + 1);
var instantiateItem = dropItem.Item.InstantiateItem(dropItem.prefab, dropPosition);
instantiateItem.GetComponentInChildren<DropItemController>().Init(dropItem, dropCount);
foreach (var element in itemInstanceList)
{
var dropChance = Random.Range(0, 101);
if (dropChance > element.Probability) continue;
var dropCount = Random.Range((int)element.Count.x, (int)element.Count.y + 1);
var instantiateItem = element.Item.InstantiateItem(element.prefab, dropPosition);
instantiateItem.GetComponentInChildren<DropItemController>().Init(element, dropCount);
}
}
}
}

View File

@ -15,7 +15,7 @@ MonoBehaviour:
itemInstanceList:
- <Item>k__BackingField: {fileID: 11400000, guid: 5adade6dd915b424e8de993bea9e3eb1,
type: 2}
<Ratio>k__BackingField: 1
<Probability>k__BackingField: 100
<Count>k__BackingField: {x: 1, y: 10}
prefab: {fileID: 4185765918994780331, guid: 3e821daa41aac7d47b39f8cfebac29d0,
type: 3}

View File

@ -15,7 +15,7 @@ MonoBehaviour:
itemInstanceList:
- <Item>k__BackingField: {fileID: 11400000, guid: e67e7a41d059c6747960d8e91b37b29d,
type: 2}
<Ratio>k__BackingField: 1
<Probability>k__BackingField: 100
<Count>k__BackingField: {x: 1, y: 3}
prefab: {fileID: 4185765918994780331, guid: 3e821daa41aac7d47b39f8cfebac29d0,
type: 3}

View File

@ -15,7 +15,7 @@ MonoBehaviour:
itemInstanceList:
- <Item>k__BackingField: {fileID: 11400000, guid: 0205e1f648508a547b6cc1a05030c7eb,
type: 2}
<Ratio>k__BackingField: 1
<Probability>k__BackingField: 100
<Count>k__BackingField: {x: 1, y: 5}
prefab: {fileID: 4185765918994780331, guid: 3e821daa41aac7d47b39f8cfebac29d0,
type: 3}

View File

@ -10,8 +10,8 @@ namespace BlueWaterProject
[field: Tooltip("아이템 데이터")]
[field: SerializeField] public Item Item { get; set; }
[field: Tooltip("아이템 드롭 비율")]
[field: SerializeField] public int Ratio { get; set; }
[field: Tooltip("아이템 드롭 비율"), Range(0, 100)]
[field: SerializeField] public int Probability { get; set; }
[field: Tooltip("아이템 랜덤 드롭 갯수")]
[field: SerializeField] public Vector2 Count { get; set; }
@ -19,10 +19,10 @@ namespace BlueWaterProject
[Tooltip("프리팹")]
public GameObject prefab;
public ItemInstance(Item item, int ratio, Vector2 count)
public ItemInstance(Item item, int probability, Vector2 count)
{
Item = item;
Ratio = ratio;
Probability = probability;
Count = count;
}
}

Binary file not shown.

View File

@ -1,8 +1,7 @@
fileFormatVersion: 2
guid: 53c414221cf3e8b4f851d61aead8fd50
NativeFormatImporter:
guid: 961736e00e6d3884da5f586d5ba02cf5
DefaultImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d329a78ae6fd1bb43b1c4cfd0e09f745
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 345812049ef08e7448c90d5beeeddf46
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,261 @@
[
{
"idx": 101,
"name": "킹크랩",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 102,
"name": "공룡 고기",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 103,
"name": "램고기",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 104,
"name": "닭고기",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 105,
"name": "뱀고기",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 106,
"name": "코뿔소 뿔",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 107,
"name": "코뿔소 다리살",
"type": 1,
"money": 0,
"weight": 100
},
{
"idx": 201,
"name": "백상어",
"type": 2,
"money": 0,
"weight": 100
},
{
"idx": 202,
"name": "니모",
"type": 2,
"money": 0,
"weight": 100
},
{
"idx": 203,
"name": "해파리",
"type": 2,
"money": 0,
"weight": 100
},
{
"idx": 204,
"name": "가오리",
"type": 2,
"money": 0,
"weight": 100
},
{
"idx": 205,
"name": "우럭",
"type": 2,
"money": 0,
"weight": 100
},
{
"idx": 301,
"name": "데스도어의 알",
"type": 3,
"money": 0,
"weight": 100
},
{
"idx": 302,
"name": "공룡알",
"type": 3,
"money": 0,
"weight": 100
},
{
"idx": 401,
"name": "메론",
"type": 4,
"money": 0,
"weight": 100
},
{
"idx": 402,
"name": "토마토",
"type": 4,
"money": 0,
"weight": 100
},
{
"idx": 403,
"name": "사과",
"type": 4,
"money": 0,
"weight": 100
},
{
"idx": 404,
"name": "레몬",
"type": 4,
"money": 0,
"weight": 100
},
{
"idx": 405,
"name": "토마토",
"type": 4,
"money": 0,
"weight": 100
},
{
"idx": 501,
"name": "마늘",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 502,
"name": "양파",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 503,
"name": "대파",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 504,
"name": "파슬리",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 505,
"name": "다시마",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 506,
"name": "파프리카",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 507,
"name": "배추",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 508,
"name": "브로콜리",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 509,
"name": "깻잎",
"type": 5,
"money": 0,
"weight": 100
},
{
"idx": 601,
"name": "진주 조개",
"type": 6,
"money": 0,
"weight": 100
},
{
"idx": 602,
"name": "바다 조개",
"type": 6,
"money": 0,
"weight": 100
},
{
"idx": 603,
"name": "거대 조개",
"type": 6,
"money": 0,
"weight": 100
},
{
"idx": 701,
"name": "소금",
"type": 7,
"money": 0,
"weight": 100
},
{
"idx": 702,
"name": "고춧가루",
"type": 7,
"money": 0,
"weight": 100
},
{
"idx": 703,
"name": "후추",
"type": 7,
"money": 0,
"weight": 100
},
{
"idx": 704,
"name": "간장",
"type": 7,
"money": 0,
"weight": 100
},
{
"idx": 705,
"name": "버터",
"type": 7,
"money": 0,
"weight": 100
},
{
"idx": 706,
"name": "설탕",
"type": 7,
"money": 0,
"weight": 100
}
]

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ae149b393d56f964883f9e06c41b068d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,306 @@
[
{
"idx": 1001,
"name": "킹크랩 앞발 구이",
"type": 1,
"taste": 1,
"money": 500,
"time": 40,
"plate": 10,
"ing1": 101,
"ing1_count": 1,
"ing2": 404,
"ing2_count": 1,
"ing3": 504,
"ing3_count": 1,
"ing4": 703,
"ing4_count": 1,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 1002,
"name": "백상어 통구이",
"type": 1,
"taste": 1,
"money": 150,
"time": 20,
"plate": 10,
"ing1": 201,
"ing1_count": 1,
"ing2": 404,
"ing2_count": 1,
"ing3": 508,
"ing3_count": 1,
"ing4": 704,
"ing4_count": 1,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 1003,
"name": "우럭 소금 구이",
"type": 1,
"taste": 3,
"money": 140,
"time": 25,
"plate": 10,
"ing1": 205,
"ing1_count": 1,
"ing2": 509,
"ing2_count": 1,
"ing3": 701,
"ing3_count": 1,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 1004,
"name": "공룡 바비큐",
"type": 1,
"taste": 2,
"money": 500,
"time": 40,
"plate": 10,
"ing1": 102,
"ing1_count": 1,
"ing2": 0,
"ing2_count": 0,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 2001,
"name": "얼큰해파리스튜",
"type": 2,
"taste": 2,
"money": 150,
"time": 20,
"plate": 10,
"ing1": 203,
"ing1_count": 1,
"ing2": 702,
"ing2_count": 1,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 2002,
"name": "짠 얼큰해파리스튜",
"type": 2,
"taste": 3,
"money": 140,
"time": 25,
"plate": 10,
"ing1": 203,
"ing1_count": 1,
"ing2": 701,
"ing2_count": 1,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 2003,
"name": "가오리 얼큰 스튜",
"type": 2,
"taste": 2,
"money": 500,
"time": 40,
"plate": 10,
"ing1": 404,
"ing1_count": 1,
"ing2": 505,
"ing2_count": 1,
"ing3": 601,
"ing3_count": 1,
"ing4": 702,
"ing4_count": 1,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 2004,
"name": "코뿔소 뿔 튀김",
"type": 2,
"taste": 4,
"money": 150,
"time": 20,
"plate": 10,
"ing1": 106,
"ing1_count": 1,
"ing2": 506,
"ing2_count": 1,
"ing3": 704,
"ing3_count": 1,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 2005,
"name": "우럭 매운탕",
"type": 2,
"taste": 2,
"money": 140,
"time": 25,
"plate": 10,
"ing1": 205,
"ing1_count": 1,
"ing2": 503,
"ing2_count": 1,
"ing3": 601,
"ing3_count": 1,
"ing4": 702,
"ing4_count": 1,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 3001,
"name": "킹크랩 미트",
"type": 3,
"taste": 1,
"money": 200,
"time": 30,
"plate": 10,
"ing1": 101,
"ing1_count": 1,
"ing2": 0,
"ing2_count": 0,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 3002,
"name": "매운 킹크랩 미트",
"type": 3,
"taste": 2,
"money": 220,
"time": 35,
"plate": 10,
"ing1": 101,
"ing1_count": 1,
"ing2": 703,
"ing2_count": 1,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 3003,
"name": "공룡알 후라이",
"type": 3,
"taste": 4,
"money": 100,
"time": 10,
"plate": 10,
"ing1": 302,
"ing1_count": 1,
"ing2": 0,
"ing2_count": 0,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 3004,
"name": "콜뿔소 뒷다리 고기",
"type": 3,
"taste": 1,
"money": 500,
"time": 40,
"plate": 10,
"ing1": 107,
"ing1_count": 1,
"ing2": 507,
"ing2_count": 1,
"ing3": 701,
"ing3_count": 1,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 3005,
"name": "컬트오드더램",
"type": 3,
"taste": 1,
"money": 150,
"time": 20,
"plate": 10,
"ing1": 103,
"ing1_count": 1,
"ing2": 402,
"ing2_count": 1,
"ing3": 501,
"ing3_count": 1,
"ing4": 701,
"ing4_count": 1,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 3006,
"name": "버터 조개 구이",
"type": 3,
"taste": 4,
"money": 140,
"time": 25,
"plate": 10,
"ing1": 603,
"ing1_count": 1,
"ing2": 503,
"ing2_count": 1,
"ing3": 705,
"ing3_count": 1,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
},
{
"idx": 4001,
"name": "해파리 젤리",
"type": 4,
"taste": 4,
"money": 0,
"time": 0,
"plate": 0,
"ing1": 0,
"ing1_count": 0,
"ing2": 0,
"ing2_count": 0,
"ing3": 0,
"ing3_count": 0,
"ing4": 0,
"ing4_count": 0,
"ing5": 0,
"ing5_count": 0
}
]

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1e26200cb116dbd48b9abd3c35634651
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,62 @@
[
{
"idx": 10101,
"name": "테스트",
"item_1": 106,
"prob": 100,
"min": 1,
"max": 1,
"item_2": 107,
"prob_1": 100,
"min_1": 1,
"max_1": 1,
"item_3": 102,
"prob_2": 70,
"min_2": 1,
"max_2": 10,
"item_4": 102,
"prob_3": 30,
"min_3": 5,
"max_3": 10
},
{
"idx": 10102,
"name": "상어",
"item_1": 201,
"prob": 100,
"min": 1,
"max": 5,
"item_2": 202,
"prob_1": 50,
"min_1": 1,
"max_1": 2,
"item_3": 0,
"prob_2": 0,
"min_2": 0,
"max_2": 0,
"item_4": 0,
"prob_3": 0,
"min_3": 0,
"max_3": 0
},
{
"idx": 10103,
"name": "가오리",
"item_1": 204,
"prob": 100,
"min": 1,
"max": 1,
"item_2": 204,
"prob_1": 50,
"min_1": 1,
"max_1": 1,
"item_3": 203,
"prob_2": 50,
"min_2": 3,
"max_2": 5,
"item_4": 0,
"prob_3": 0,
"min_3": 0,
"max_3": 0
}
]

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0d1812ace34fd604d9ebd88cfd031b6e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: