티스토리 뷰
#게임 테스트를 계속 진행하다보니 장비가 유저의 전투력에 큰 영향을 미친다 생각이 되었다.
장비를 보관할 수 있는 인벤토리의 용량에 대한 로직을 수정할 필요가 있었다.
이전에 유저는 2000Gold를 상점에 지불하면 용량을 무한정으로 늘릴 수 있었다.
이렇게 둔다면 유저의 전투력은 무한정으로 상승하게 될 것 이고 장비의 벨런스도 무너질 가능성이 보였다.
유저의 인벤토리 최대 용량과 지불 비용에 제한을 둘 필요가 보였다.
먼저 인벤토리 최대 용량에 대한 로직을 생각해보았다.
어떤식으로 제한을 둘지 먼저 정해야 했다. 윤회 횟수를 참조하여 제한을 두기로 정했다.
현재 유저는 기본으로 5칸의 인벤토리 용량을 갖고 게임을 시작한다
1윤회일때 9칸까지 용량을 증가시킬 수 있다. (첫 윤회때는 많이 강해진 상태로 게임이 진행되어야했다. 2윤회때 부터는 난이도가 많이 올라가기 때문이다)
그 후 2윤회때는 11칸, 3윤회떄는 13칸 ... 이렇게 윤회 횟수가 증가 할 때 마다
유저가 최대 증가시킬 수 있는 인벤토리 용량은 2칸씩 늘어난다.
그 다음 고민 할 부분은 인벤토리 용량 증가 비용이다.
처음에는 똑같이 윤회 횟수를 참조하려 했으나, 현재 인벤토리 용량을 참조하여 가격을 올리기로 수정해봤다
기본 5칸일때에는 6칸으로 증가시키기위한 비용은 5000골드, 7칸은 10000골드, 8칸은 15000골드 ...
한칸씩 증가할때 마다 5000골드씩 비용이 증가한다. 비용은 무한정으로 증가하게 된다면 유저의 비용 부담이 커질테니
비용이 55000골드가 된다면 더이상 가격은 오르지 않고 55000골드로 비용을 고정시켜놨다.
*인벤토리 용량 로직에대한 코드
public void Init()
{
this.rounCount = InfoManager.instance.gameInfo.roundCnt;
var audioSource = this.audioGo.GetComponent<AudioSource>();
this.txtCurCount.text = InfoManager.instance.inventoryInfo.InventoryCount.ToString(); //현재 인벤 용량
this.txtIncCount.text = (InfoManager.instance.inventoryInfo.InventoryCount + 1).ToString();
//this.invecnPrice = InfoManager.instance.gameInfo.roundCnt * 2000; // -> 현재 인벤 용량 참조하여 가격상승으로 변경 필요
//Test
this.invecnPrice = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount);
this.txtPriceDetail.text = invecnPrice.ToString();
this.txtCurrentGoldDetail.text = InfoManager.instance.possessionAmountInfo.goldAmount.ToString();
this.isGoldEnough = true;
this.dim.onClick.AddListener(() => {
this.gameObject.SetActive(false);
});
this.btnClose.onClick.AddListener(() => {
AudioManager.instance.PlaySFXOneShot(AudioManager.eSFXMusicPlayList.UI_Close, audioSource);
this.gameObject.SetActive(false);
});
this.btnCancle.onClick.AddListener(() => {
AudioManager.instance.PlaySFXOneShot(AudioManager.eSFXMusicPlayList.UI_Close, audioSource);
this.gameObject.SetActive(false);
});
//Select
this.btnSelect.onClick.AddListener(() => {
AudioManager.instance.PlaySFXOneShot(AudioManager.eSFXMusicPlayList.UI_Close, audioSource);
this.CheckEnoughGold();
this.IncreaseInventoryVolum();
});
}
public void CheckEnoughGold()
{
this.txtCurCount.text = InfoManager.instance.inventoryInfo.InventoryCount.ToString(); //현재 인벤 용량
this.txtIncCount.text = $"<color=#00FF00>{(InfoManager.instance.inventoryInfo.InventoryCount + 1).ToString()}</color>";
this.txtCurrentGoldDetail.text = " / " + InfoManager.instance.possessionAmountInfo.goldAmount.ToString();
int invenCount = InfoManager.instance.inventoryInfo.InventoryCount;
int maxInvenCnt = InfoManager.instance.inventoryInfo.maxInvenCount;
//Test
this.invecnPrice = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount);
Debug.LogFormat("CheckGold maxInvenCnt:{0},roundCnt:{1}",maxInvenCnt,this.rounCount);
if (InfoManager.instance.possessionAmountInfo.goldAmount >= this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount)&& //this.invecnPrice &&
invenCount < (maxInvenCnt+(this.rounCount*2))) //1->9., 2->11, 3->13
{
Debug.Log("수락");
EventDispatcher.Instance.Dispatch(EventDispatcher.EventName.UICurrencyDirectorUpdateEtherUI);
this.isGoldEnough = true;
this.txtCurCount.text = (invenCount).ToString();
this.txtIncCount.text = (invenCount + 1).ToString();
//Test
this.txtPriceDetail.text = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount).ToString();
this.OnSelectButton();
}
else
{
Debug.Log("거절");
this.isGoldEnough = false;
if(invenCount== (maxInvenCnt + (this.rounCount * 2)))
{
this.txtCurCount.text = "<Color=red>Max</Color>";
this.txtIncCount.text = "<Color=red>Max</Color>";
//Test
this.txtPriceDetail.text = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount).ToString();
this.OffSelectButton();
}
else if(InfoManager.instance.possessionAmountInfo.goldAmount< this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount))//this.invecnPrice) //2000
{
this.txtCurCount.text = "";
this.txtIcon.text = "";
this.txtIncCount.text = "<Color=red>Gold 부족</Color>"; //위치,영역 조절
this.txtIncCount.rectTransform.anchoredPosition = new Vector3(-11f, -103f, 0f);
//Test
this.txtPriceDetail.text = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount).ToString();
this.OffSelectButton();
}
}
}
/// <summary>
/// 인벤 용량 증가메서드, 임시 최대 용량 9
/// </summary>
private void IncreaseInventoryVolum()
{
int invenCount = InfoManager.instance.inventoryInfo.InventoryCount;
int maxInvenCnt = InfoManager.instance.inventoryInfo.maxInvenCount;
//Test
this.invecnPrice = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount);
if (this.isGoldEnough) // 인벤토리 용량 최대 =9 (임시 값)
{
invenCount =InfoManager.instance.IncreaseInventoryCount(); //인벤토리 용량 증가
this.txtCurCount.text = (invenCount).ToString();
this.txtIncCount.text = $"<color=#00FF00>{(invenCount + 1).ToString()}</color>";
this.ConsumptionGold();
EventDispatcher.Instance.Dispatch(EventDispatcher.EventName.UIInventoryAddCell);
Debug.LogFormat("{0}", invenCount.ToString());
//Test
this.txtPriceDetail.text = this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount).ToString();
}
else if (!this.isGoldEnough)
{
if (invenCount == (maxInvenCnt + (this.rounCount * 2)))
{
this.txtCurCount.text = "<Color=red>Max</Color>";
this.txtIncCount.text = "<Color=red>Max</Color>";
}
else if (InfoManager.instance.possessionAmountInfo.goldAmount < this.CalculateInventoryPrice(InfoManager.instance.inventoryInfo.InventoryCount))//this.invecnPrice) //2000
{
this.txtCurCount.text = "";
this.txtIcon.text = "";
this.txtIncCount.text = "<Color=red>Gold 부족</Color>"; //위치,영역 조절
this.txtIncCount.rectTransform.anchoredPosition = new Vector3(-11f, -103f, 0f);
}
}
}
*인벤토리 용량 비용 증가 로직에 대한 코드
/// <summary>
/// 인벤토리 용량 증가 가격 설정
/// </summary>
/// <param name="inventorySize"></param>
/// <returns></returns>
private int CalculateInventoryPrice(int inventorySize)
{
int basePrice = 5000; //디폴트 가격
int maxPrice = 55000; //최대가격
int priceIncrement = 5000; //증가하는 가격
int price = basePrice + (inventorySize - 5) * priceIncrement;
return Mathf.Min(price, maxPrice);
}
*Test(최대 비용을 체크하기 위하여 6 윤회에서 진행)
*계속 테스트를 진행하며 퀄업과 벨런스를 조정중이다.
개발할때와 다른 느낌이다. 놓친점도 많고 벨런스도 많이 손봐야했다.
가장 어려웠던 부분은 UI퀄리티였다. 어떻게하면 유저의 편의성에 적합한 UI가 나올지에 대한 고민이 많이됐다.
(나는 상점 UI를 수정했다. 텍스트 크기와 위치, 색상 등 신경쓸 부분이 아주 많았다)
아쉬웠던 부분은 기획 단계에서 UI, 시스템 기획을 좀 더 철저하게 세우고 시작했어야 한다는 점이다.
'게임클라이언트 프로그래밍 > Guns N Rachel's' 카테고리의 다른 글
Boss 코드 리펙토링 (0) | 2023.07.06 |
---|---|
드랍아이템 겹치는 버그 수정 (0) | 2023.06.03 |
AES 대칭키 알고리즘을 이용한 데이터 암호화/복호화 (0) | 2023.05.29 |
UI Text변경, Dice연출 수정 (0) | 2023.05.29 |
Dice 버그 수정, 연출 추가(등급별 연출) (0) | 2023.05.25 |