47 lines
2.2 KiB
C#
47 lines
2.2 KiB
C#
using System.Collections.Generic;
|
|
using BlueWater.Items;
|
|
using UnityEngine;
|
|
using Random = UnityEngine.Random;
|
|
|
|
namespace BlueWater
|
|
{
|
|
[CreateAssetMenu(fileName = "CardTable", menuName = "ScriptableObjects/CardTable")]
|
|
|
|
public class CardDataSo : DataSo<CardData>
|
|
{
|
|
//(임시) 카드 종류를 탐색해서 치환하는 작업 (리퀴드와 가니쉬에 해당함)
|
|
//확률적으로 문제가 있기 때문에, 해당 확률를 고려해서 카드를 변경시키는 기능
|
|
//EX -> 10레벨 상태에서 AddLiquidE 가 나왔을 경우 B, C 둘중 하나로 치환함
|
|
//만약에 5레벨보다 작으면 null값 리턴
|
|
public CardData SubstitutionLiquid(CardData cardData, LevelData levelData)
|
|
{
|
|
if (cardData.Idx.Equals("AddLiquidB") || cardData.Idx.Equals("AddLiquidC") || cardData.Idx.Equals("AddLiquidD") ||
|
|
cardData.Idx.Equals("AddLiquidE") || cardData.Idx.Equals("AddGarnish1") || cardData.Idx.Equals("AddGarnish2") || cardData.Idx.Equals("AllLiquidAdd"))
|
|
{
|
|
int levelIdx = int.Parse(levelData.Idx);
|
|
|
|
if (levelIdx <= 5)
|
|
{
|
|
return null;
|
|
}
|
|
else if (cardData.Idx.Equals("AllLiquidAdd"))
|
|
{
|
|
return cardData;
|
|
}
|
|
|
|
List<CardData> activeLiquid = new List<CardData>();
|
|
|
|
if (levelIdx > 5) activeLiquid.Add(GetDataByIdx("AddLiquidB"));
|
|
if (levelIdx > 10) activeLiquid.Add(GetDataByIdx("AddLiquidC"));
|
|
if (levelIdx > 15) activeLiquid.Add(GetDataByIdx("AddLiquidD"));
|
|
if (levelIdx > 20) activeLiquid.Add(GetDataByIdx("AddLiquidE"));
|
|
if (levelIdx > 25) activeLiquid.Add(GetDataByIdx("AddGarnish1"));
|
|
if (levelIdx > 30) activeLiquid.Add(GetDataByIdx("AddGarnish2"));
|
|
|
|
// 액체 목록에서 랜덤하게 선택하여 반환
|
|
return activeLiquid[Random.Range(0, activeLiquid.Count)];
|
|
}
|
|
return cardData; // 해당 사항이 없으면 치환하지 않음
|
|
}
|
|
}
|
|
} |