public void ChangeSprite(ModelSlot modelSlot, Sprite fSprite, Sprite sSprite, Sprite bSprite) { int index = (int)modelSlot; if (frontSprite[index].spriteMeshIsInstance && sideSprite[index].spriteMeshIsInstance && backSprite[index].spriteMeshIsInstance) { frontSprite[index].spriteMesh.sprite = fSprite; sideSprite[index].spriteMesh.sprite = sSprite; backSprite[index].spriteMesh.sprite = bSprite; } }
public override void UpdatePanel() { base.UpdatePanel(); ModelSlot modelSlot = GameManager.Instance.Models[selectModelIndex].GetComponent <ModelSlot>(); if (modelSlot != null) { // 선택된 모델 이름 및 이미지 출력 selectModelImage.sprite = modelSlot.Icon; } else { Debug.Log("null"); } }
/// <summary> /// 모델 스프라이트 이미지 초기화 /// </summary> void ModelSpriteInit() { GameManager gameManager = GameManager.Instance; // 모델 스프라이트 이미지 지정 for (int i = 0; i < gameManager.GunModels.Length; i++) { ModelSlot modelSlot = gameManager.Models[i].GetComponent <ModelSlot>(); if (modelSlot != null) { modelsBtn[i].image.sprite = modelSlot.Icon; // 구매 가능한 모델일 경우 구매에 필요한 골드 노출 ActivatedBuyGold(i, modelSlot.BuyableGold); } } }
/// <summary> /// 선택 모델 인덱스 저장 버튼 /// </summary> /// <param name="index"></param> public void OnSelectModelBtn(int index) { // 버튼음 재생 GameManager.Instance.SoundManager.PlaySFX(AudioNameConstant.BUTTON_SOUND); selectModelIndex = index; ActivatedEquipBuyButton(index); // 구매 가능한 모델의 경우 오른쪽 밑단 가격 표시 if (BuyableModelCheck(index)) { ModelSlot modelSlot = GameManager.Instance.Models[selectModelIndex].GetComponent <ModelSlot>(); if (modelSlot != null) { UpdateGoldText(modelSlot.BuyableGold.ToString()); } } else { UpdateGoldText(""); } }
/// <summary> /// 모델 구입 처리 함수 /// </summary> public void OnBuyModel() { // 버튼음 재생 GameManager.Instance.SoundManager.PlaySFX(AudioNameConstant.BUTTON_SOUND); ModelSlot modelSlot = GameManager.Instance.Models[selectModelIndex].GetComponent <ModelSlot>(); if (modelSlot != null) { // 구매 가능한 골드를 소지하고 있는 경우 if (saveData.gold >= modelSlot.BuyableGold) { // 구매 가능한 모델 리스트에서 삭제 saveData.buyableModels.Remove(selectModelIndex); // 골드 차감 saveData.gold -= modelSlot.BuyableGold; GameManager.Instance.DataBase.Save(); // 구매/장착 버튼 활성/비활성 ActivatedEquipBuyButton(selectModelIndex); // 구매에 필요한 골드 활성/비활성 ActivatedBuyGold(selectModelIndex, modelSlot.BuyableGold); } } }