DEG-165 [Feat] 집안일 후 랜덤 하게 랜덤 강화
This commit is contained in:
parent
4ffed3b1d1
commit
c36be7ab93
@ -31,6 +31,8 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
private RectTransform backgroundRectTransform;
|
private RectTransform backgroundRectTransform;
|
||||||
private List<Button> cards = new List<Button>();
|
private List<Button> cards = new List<Button>();
|
||||||
|
|
||||||
|
private bool isHome = false;
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
if(canvas == null)
|
if(canvas == null)
|
||||||
@ -83,6 +85,36 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 랜덤한 강화 카드 1장
|
||||||
|
/// </summary>
|
||||||
|
public void StartUpgradeInHome()
|
||||||
|
{
|
||||||
|
isHome = true;
|
||||||
|
|
||||||
|
DrawStatNumber();
|
||||||
|
|
||||||
|
//배경 패널 생성
|
||||||
|
if(backgroundRectTransform == null)
|
||||||
|
backgroundRectTransform = Instantiate(backgroundPanel,canvas.transform).GetComponent<RectTransform>();
|
||||||
|
//배경 패널 애니메이션 적용
|
||||||
|
backgroundRectTransform.gameObject.SetActive(true);
|
||||||
|
StartCoroutine(CoFade(backgroundRectTransform.gameObject, 0f,0.7f,0.2f));
|
||||||
|
|
||||||
|
EnsureCardListSize(3);
|
||||||
|
|
||||||
|
if(cards[0] == null)
|
||||||
|
cards[0] = Instantiate(upgradeButton, backgroundRectTransform);
|
||||||
|
|
||||||
|
cards[0].gameObject.SetActive(true);
|
||||||
|
cards[0].GetComponent<UpgradeCard>().Init((StatType)stats[0]);
|
||||||
|
StartCoroutine(CoFade(cards[0].gameObject, 0f,1f,0.4f, () =>
|
||||||
|
{
|
||||||
|
cards[0].GetComponent<CanvasGroup>().interactable = true;
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 중복되지 않는 랜덤한 스탯 번호 뽑기
|
/// 중복되지 않는 랜덤한 스탯 번호 뽑기
|
||||||
@ -130,13 +162,15 @@ public class UpgradeManager : Singleton<UpgradeManager>
|
|||||||
public void DestroyUpgradeCard()
|
public void DestroyUpgradeCard()
|
||||||
{
|
{
|
||||||
// 카드 비활성화
|
// 카드 비활성화
|
||||||
if (stats.Count == 0)
|
if (stats.Count == 0 || isHome)
|
||||||
{
|
{
|
||||||
StartCoroutine(CoFade(cards[0].gameObject, 1f,0f,0.4f,() =>
|
StartCoroutine(CoFade(cards[0].gameObject, 1f,0f,0.4f,() =>
|
||||||
{
|
{
|
||||||
cards[0].gameObject.SetActive(false);
|
cards[0].gameObject.SetActive(false);
|
||||||
backgroundRectTransform.gameObject.SetActive(false);
|
backgroundRectTransform.gameObject.SetActive(false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
isHome = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
public class InteractionAnimationPanelController : MonoBehaviour
|
public class InteractionAnimationPanelController : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -107,6 +108,16 @@ public class InteractionAnimationPanelController : MonoBehaviour
|
|||||||
//패널 닫고 애니메이션 null처리
|
//패널 닫고 애니메이션 null처리
|
||||||
HidePanel();
|
HidePanel();
|
||||||
_autoHideCoroutine = null;
|
_autoHideCoroutine = null;
|
||||||
|
|
||||||
|
if (actionType == ActionType.Housework)
|
||||||
|
{
|
||||||
|
var chance = 0.7f; // 30% 확률
|
||||||
|
|
||||||
|
if (Random.value < chance)
|
||||||
|
{
|
||||||
|
UpgradeManager.Instance.StartUpgradeInHome();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HidePanel()
|
private void HidePanel()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user