CapersProject/Assets/02.Scripts/Item/Food/FoodData.cs
2024-08-22 19:39:15 +09:00

111 lines
4.3 KiB
C#

using System;
using System.Collections.Generic;
using BlueWater.Interfaces;
using Sirenix.OdinInspector;
using UnityEngine;
namespace BlueWater.Items
{
public enum FoodType
{
None = 0,
Skewer,
Soup,
Grill,
Dessert,
}
public enum FoodTaste
{
None = 0,
Savory,
Spicy,
Salty,
Sweet
}
[Serializable]
public class FoodData : IIdx
{
[BoxGroup("Json 데이터 영역")]
[field: SerializeField, Tooltip("고유 식별 ID"), BoxGroup("Json 데이터 영역")]
public string Idx { get; set; }
[field: SerializeField, Tooltip("이름"), BoxGroup("Json 데이터 영역")]
public string Name { get; set; }
[field: SerializeField, Tooltip("음식의 종류"), BoxGroup("Json 데이터 영역")]
public FoodType Type { get; set; }
[field: SerializeField, Tooltip("음식의 맛"), BoxGroup("Json 데이터 영역")]
public FoodTaste Taste { get; set; }
[field: SerializeField, Tooltip("음식 제작 시간"), BoxGroup("Json 데이터 영역")]
public int CookGauge { get; set; }
[field: SerializeField, Tooltip("음식 제작에 나오는 접시 수"), BoxGroup("Json 데이터 영역")]
public int Plate { get; set; }
[field: SerializeField, Tooltip("1번 재료 식별 Idx"), BoxGroup("Json 데이터 영역")]
public string IngredientIdx1 { get; set; }
[field: SerializeField, Tooltip("1번 재료 수량 Idx"), BoxGroup("Json 데이터 영역")]
public int IngredientQuantity1 { get; set; }
[field: SerializeField, Tooltip("2번 재료 식별 Idx"), BoxGroup("Json 데이터 영역")]
public string IngredientIdx2 { get; set; }
[field: SerializeField, Tooltip("2번 재료 수량 Idx"), BoxGroup("Json 데이터 영역")]
public int IngredientQuantity2 { get; set; }
[field: SerializeField, Tooltip("3번 재료 식별 Idx"), BoxGroup("Json 데이터 영역")]
public string IngredientIdx3 { get; set; }
[field: SerializeField, Tooltip("3번 재료 수량 Idx"), BoxGroup("Json 데이터 영역")]
public int IngredientQuantity3 { get; set; }
[field: SerializeField, Tooltip("4번 재료 식별 Idx"), BoxGroup("Json 데이터 영역")]
public string IngredientIdx4 { get; set; }
[field: SerializeField, Tooltip("4번 재료 수량 Idx"), BoxGroup("Json 데이터 영역")]
public int IngredientQuantity4 { get; set; }
[field: SerializeField, Tooltip("5번 재료 식별 Idx"), BoxGroup("Json 데이터 영역")]
public string IngredientIdx5 { get; set; }
[field: SerializeField, Tooltip("5번 재료 수량 Idx"), BoxGroup("Json 데이터 영역")]
public int IngredientQuantity5 { get; set; }
public List<Ingredient> GetValidIngredients()
{
var ingredients = new List<Ingredient>(5);
if (!string.IsNullOrEmpty(IngredientIdx1)) ingredients.Add(new Ingredient(IngredientIdx1, IngredientQuantity1));
if (!string.IsNullOrEmpty(IngredientIdx2)) ingredients.Add(new Ingredient(IngredientIdx2, IngredientQuantity2));
if (!string.IsNullOrEmpty(IngredientIdx3)) ingredients.Add(new Ingredient(IngredientIdx3, IngredientQuantity3));
if (!string.IsNullOrEmpty(IngredientIdx4)) ingredients.Add(new Ingredient(IngredientIdx4, IngredientQuantity4));
if (!string.IsNullOrEmpty(IngredientIdx5)) ingredients.Add(new Ingredient(IngredientIdx5, IngredientQuantity5));
return ingredients;
}
public string TasteToString()
{
switch (Taste)
{
case FoodTaste.None:
return null;
case FoodTaste.Savory:
return "고소한 맛";
case FoodTaste.Spicy:
return "매운맛";
case FoodTaste.Salty:
return "짠맛";
case FoodTaste.Sweet:
return "단맛";
default:
throw new ArgumentOutOfRangeException();
}
}
}
}