579 lines
23 KiB
C#
579 lines
23 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using CodeJay.Enum;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
// GamePanel Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̱<EFBFBD><CCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.
|
|||
|
|
// <20>ܺο<DCBA><CEBF><EFBFBD><EFBFBD><EFBFBD> GamePane.Instance<63><65> <20><><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.
|
|||
|
|
|
|||
|
|
public partial class GamePanel : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
#region Enum
|
|||
|
|
public enum EGameWorkFlowType
|
|||
|
|
{
|
|||
|
|
DistributeCard,
|
|||
|
|
DiscardNEffectBeforeDiscard,
|
|||
|
|
CheckMatchedCardAfterDiscard,
|
|||
|
|
FlipCenterCard,
|
|||
|
|
BringTheGetableCards,
|
|||
|
|
CheckCombination,
|
|||
|
|
CheckEndOrGoStop,
|
|||
|
|
Max
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public enum EGameStateType
|
|||
|
|
{
|
|||
|
|
None,
|
|||
|
|
InProgress,
|
|||
|
|
Complete,
|
|||
|
|
Error,
|
|||
|
|
Max
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Fields
|
|||
|
|
private WaitForEndOfFrame _endofFrame = new WaitForEndOfFrame();
|
|||
|
|
private WaitForSeconds _waitforSecondsZeroDotZeroOne = new WaitForSeconds(0.05f);
|
|||
|
|
private WaitForSeconds _waitforSecondsZeroDotOne = new WaitForSeconds(0.1f);
|
|||
|
|
private WaitForSeconds _waitforSecondsZeroDotTwoFive = new WaitForSeconds(0.25f);
|
|||
|
|
private WaitForSeconds _waitforSecondsAIBehaviour = new WaitForSeconds(1f);
|
|||
|
|
private CardSlot _discardSlot = null;
|
|||
|
|
|
|||
|
|
private Dictionary<EGameWorkFlowType, EGameStateType> _dicCoroutineStates;
|
|||
|
|
|
|||
|
|
private EGameWorkFlowType _currentCoroutineType = EGameWorkFlowType.Max;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Properties
|
|||
|
|
private EGameWorkFlowType CurrentCoroutineType
|
|||
|
|
{
|
|||
|
|
get => _currentCoroutineType;
|
|||
|
|
set => _currentCoroutineType = value;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Coroutines
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>ϴ<EFBFBD> <20>ڷ<EFBFBD>ƾ
|
|||
|
|
private IEnumerator coroCheckCombination()
|
|||
|
|
{
|
|||
|
|
// <20>÷<EFBFBD><C3B7>̾<EFBFBD><CCBE><EFBFBD><EFBFBD>̶<EFBFBD><CCB6>
|
|||
|
|
if (PlayerTurn)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7>̾<EFBFBD> <20><><EFBFBD>ھ<DABE><EEBAB8> ī<><C4AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<>´<EFBFBD>.
|
|||
|
|
var combinations = CodeJay.CodeJayUtility.Utility.GetCombinationTypes(ref _lstPlayerScoreCards);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD> <20>ִٸ<D6B4>
|
|||
|
|
for (int i = 0; i < combinations.Count; i++)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6>
|
|||
|
|
if (_hashPlayerCombinations.Contains(combinations[i]) == false)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> '<27><>' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|||
|
|
switch (combinations[i])
|
|||
|
|
{
|
|||
|
|
case ECombinationType.Three_Ghwang:
|
|||
|
|
if (_hashPlayerCombinations.Contains(ECombinationType.Be_Three_Ghwang))
|
|||
|
|
_hashPlayerCombinations.Remove(ECombinationType.Be_Three_Ghwang);
|
|||
|
|
break;
|
|||
|
|
case ECombinationType.Four_Ghwang:
|
|||
|
|
if (_hashPlayerCombinations.Contains(ECombinationType.Be_Three_Ghwang))
|
|||
|
|
_hashPlayerCombinations.Remove(ECombinationType.Be_Three_Ghwang);
|
|||
|
|
if (_hashPlayerCombinations.Contains(ECombinationType.Three_Ghwang))
|
|||
|
|
_hashPlayerCombinations.Remove(ECombinationType.Three_Ghwang);
|
|||
|
|
break;
|
|||
|
|
case ECombinationType.Five_Ghwang:
|
|||
|
|
if (_hashPlayerCombinations.Contains(ECombinationType.Be_Three_Ghwang))
|
|||
|
|
_hashPlayerCombinations.Remove(ECombinationType.Be_Three_Ghwang);
|
|||
|
|
if (_hashPlayerCombinations.Contains(ECombinationType.Three_Ghwang))
|
|||
|
|
_hashPlayerCombinations.Remove(ECombinationType.Three_Ghwang);
|
|||
|
|
if (_hashPlayerCombinations.Contains(ECombinationType.Four_Ghwang))
|
|||
|
|
_hashPlayerCombinations.Remove(ECombinationType.Four_Ghwang);
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ٸ<EFBFBD>
|
|||
|
|
_hashPlayerCombinations.Add(combinations[i]);
|
|||
|
|
yield return EffectPanel.Direct(combinations[i], true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><> <20><><EFBFBD>ھ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
int score = GetTotalScore(true, false);
|
|||
|
|
|
|||
|
|
// '<27><>' <20><EFBFBD><EEB0B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
int peeNumber = GetScoreBoardTypeNumber(true, ECardScoreType.Pee);
|
|||
|
|
bool hasSepYulgget = false;
|
|||
|
|
for (int i = 0; i < _lstPlayerScoreCards.Count; i++)
|
|||
|
|
{
|
|||
|
|
if (_lstPlayerScoreCards[i] == ECardType.Sep_Yulkkeut)
|
|||
|
|
{
|
|||
|
|
hasSepYulgget = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5<><35> <20>̻<EFBFBD><CCBB>̰<EFBFBD> 9<><39> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ھ<EFBFBD> <20><><EFBFBD>忡 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ְ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ƿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾҴٸ<D2B4>.
|
|||
|
|
if (score >= 5 && hasSepYulgget && _isSelctedSepYulggetState == false)
|
|||
|
|
{
|
|||
|
|
_isSelctedSepYulggetState = true;
|
|||
|
|
|
|||
|
|
CardSlot slot = GetCardSlot(ECardType.Sep_Yulkkeut);
|
|||
|
|
|
|||
|
|
if (slot.LocationType == ECardLocationType.Player_Score)
|
|||
|
|
{
|
|||
|
|
bool result = false;
|
|||
|
|
System.Action<bool> action = (bool b) => result = b;
|
|||
|
|
GameManager.UI.ShowNStackPopup<DoublePeeSelectPopup>(EPopupType.DoublePeeSelectPopup).SetData(action);
|
|||
|
|
|
|||
|
|
yield return _waitforSecondsZeroDotOne;
|
|||
|
|
|
|||
|
|
yield return new WaitUntil(() => GameManager.UI.IsOpendPopup(EPopupType.DoublePeeSelectPopup) == false);
|
|||
|
|
|
|||
|
|
if (result)
|
|||
|
|
{
|
|||
|
|
slot.Move(ECardLocationType.Player_Score, ECardLocationType.Player_Score, Player_Pee.AddCard(ECardType.Sep_Yulkkeut));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// <20>÷<EFBFBD><C3B7>̾<EFBFBD> <20><><EFBFBD><EFBFBD> 9<><39> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ø<EFBFBD> <20>ڵ<EFBFBD><DAB5>̰<EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
SortAICards();
|
|||
|
|
|
|||
|
|
var combinations = CodeJay.CodeJayUtility.Utility.GetCombinationTypes(ref _lstAIScoreCards);
|
|||
|
|
|
|||
|
|
for (int i = 0; i < combinations.Count; i++)
|
|||
|
|
{
|
|||
|
|
if (_hashAICombinations.Contains(combinations[i]) == false)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> '<27><>' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|||
|
|
switch (combinations[i])
|
|||
|
|
{
|
|||
|
|
case ECombinationType.Three_Ghwang:
|
|||
|
|
if (_hashAICombinations.Contains(ECombinationType.Be_Three_Ghwang))
|
|||
|
|
_hashAICombinations.Remove(ECombinationType.Be_Three_Ghwang);
|
|||
|
|
break;
|
|||
|
|
case ECombinationType.Four_Ghwang:
|
|||
|
|
if (_hashAICombinations.Contains(ECombinationType.Be_Three_Ghwang))
|
|||
|
|
_hashAICombinations.Remove(ECombinationType.Be_Three_Ghwang);
|
|||
|
|
if (_hashAICombinations.Contains(ECombinationType.Three_Ghwang))
|
|||
|
|
_hashAICombinations.Remove(ECombinationType.Three_Ghwang);
|
|||
|
|
break;
|
|||
|
|
case ECombinationType.Five_Ghwang:
|
|||
|
|
if (_hashAICombinations.Contains(ECombinationType.Be_Three_Ghwang))
|
|||
|
|
_hashAICombinations.Remove(ECombinationType.Be_Three_Ghwang);
|
|||
|
|
if (_hashAICombinations.Contains(ECombinationType.Three_Ghwang))
|
|||
|
|
_hashAICombinations.Remove(ECombinationType.Three_Ghwang);
|
|||
|
|
if (_hashAICombinations.Contains(ECombinationType.Four_Ghwang))
|
|||
|
|
_hashAICombinations.Remove(ECombinationType.Four_Ghwang);
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_hashAICombinations.Add(combinations[i]);
|
|||
|
|
yield return EffectPanel.Direct(combinations[i], false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int score = GetTotalScore(false, false);
|
|||
|
|
int peeNumber = GetScoreBoardTypeNumber(false, ECardScoreType.Pee);
|
|||
|
|
|
|||
|
|
bool hasSepYulgget = false;
|
|||
|
|
for (int i = 0; i < _lstAIScoreCards.Count; i++)
|
|||
|
|
{
|
|||
|
|
if (_lstAIScoreCards[i] == ECardType.Sep_Yulkkeut)
|
|||
|
|
{
|
|||
|
|
hasSepYulgget = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (score >= 5 && hasSepYulgget && _isSelctedSepYulggetState == false)
|
|||
|
|
{
|
|||
|
|
_isSelctedSepYulggetState = true;
|
|||
|
|
|
|||
|
|
CardSlot slot = GetCardSlot(ECardType.Sep_Yulkkeut);
|
|||
|
|
|
|||
|
|
if (slot.LocationType == ECardLocationType.AI_Score)
|
|||
|
|
{
|
|||
|
|
bool result = Random.Range(0, 2) > 0;
|
|||
|
|
GameManager.UI.ShowNStackPopup<WaitForAIBehaviourPopup>(EPopupType.WaitForAIBehaviourPopup).SetData(1f);
|
|||
|
|
yield return _waitforSecondsAIBehaviour;
|
|||
|
|
|
|||
|
|
if (result)
|
|||
|
|
{
|
|||
|
|
UseSepYulgget_To_Pee = result;
|
|||
|
|
slot.Move(ECardLocationType.Player_Score, ECardLocationType.Player_Score, Player_Pee.AddCard(ECardType.Sep_Yulkkeut));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeScore);
|
|||
|
|
CurrentCoroutineType = EGameWorkFlowType.CheckEndOrGoStop;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private IEnumerator coroCheckEndOrGoStop()
|
|||
|
|
{
|
|||
|
|
if (GetMatchedCardSlotNumber(ECardLocationType.Center) <= 0)
|
|||
|
|
{
|
|||
|
|
if (PlayerTurn)
|
|||
|
|
{
|
|||
|
|
if (GetTotalScore(true, false) >= 7)
|
|||
|
|
{
|
|||
|
|
GameOver = true;
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(true);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int handNumber = GetMatchedCardSlotNumber(ECardLocationType.Player_Hand);
|
|||
|
|
int centerNumber = GetMatchedCardSlotNumber(ECardLocationType.Center);
|
|||
|
|
|
|||
|
|
if (handNumber <= 0 && centerNumber <= 0)
|
|||
|
|
{
|
|||
|
|
yield return StartCoroutine(EffectPanel.NagariEffect());
|
|||
|
|
GameManager.UI.ShowNStackPopup<NagariPopup>(EPopupType.NagariPopup);
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (GetTotalScore(false, false) >= 7)
|
|||
|
|
{
|
|||
|
|
GameOver = true;
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int handNumber = GetMatchedCardSlotNumber(ECardLocationType.AI_Hand);
|
|||
|
|
int centerNumber = GetMatchedCardSlotNumber(ECardLocationType.Center);
|
|||
|
|
|
|||
|
|
if (handNumber <= 0 && centerNumber <= 0)
|
|||
|
|
{
|
|||
|
|
yield return StartCoroutine(EffectPanel.NagariEffect());
|
|||
|
|
GameManager.UI.ShowNStackPopup<NagariPopup>(EPopupType.NagariPopup);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (PlayerTurn)
|
|||
|
|
{
|
|||
|
|
int score = GetTotalScore(true, false);
|
|||
|
|
if (score >= 7)
|
|||
|
|
{
|
|||
|
|
int handNumber = GetMatchedCardSlotNumber(ECardLocationType.Player_Hand);
|
|||
|
|
|
|||
|
|
if (Player_Go <= 0)
|
|||
|
|
{
|
|||
|
|
if (handNumber <= 0)
|
|||
|
|
{
|
|||
|
|
yield return EffectPanel.Direct(EEffectDirectType.Stop, true);
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(true);
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
GameManager.UI.ShowNStackPopup(EPopupType.GoStopPopup);
|
|||
|
|
yield return _waitforSecondsZeroDotOne;
|
|||
|
|
yield return new WaitUntil(() => GameManager.UI.IsOpendPopup(EPopupType.GoStopPopup) == false);
|
|||
|
|
|
|||
|
|
if (GameOver)
|
|||
|
|
yield break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// <20>̹<EFBFBD> 1<><31> <20>̻<EFBFBD><CCBB><EFBFBD> go<67><6F> <20>߱<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>ٽ<EFBFBD> Go<47><6F> Stop<6F><70> <20><><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ƾ<EFBFBD><C6BE>Ѵ<EFBFBD>.
|
|||
|
|
else if (score > _prevScore_Player)
|
|||
|
|
{
|
|||
|
|
if (handNumber > 0)
|
|||
|
|
{
|
|||
|
|
GameManager.UI.ShowNStackPopup(EPopupType.GoStopPopup);
|
|||
|
|
|
|||
|
|
yield return _waitforSecondsZeroDotOne;
|
|||
|
|
yield return new WaitUntil(() => GameManager.UI.IsOpendPopup(EPopupType.GoStopPopup) == false);
|
|||
|
|
|
|||
|
|
if (GameOver)
|
|||
|
|
yield break;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
yield return EffectPanel.Direct(EEffectDirectType.Stop, true);
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(true);
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʾƼ<CABE> GO<47><4F> Stop<6F><70> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int centerNumber = GetMatchedCardSlotNumber(ECardLocationType.Center);
|
|||
|
|
|
|||
|
|
if (handNumber <= 0)
|
|||
|
|
{
|
|||
|
|
yield return StartCoroutine(EffectPanel.NagariEffect());
|
|||
|
|
GameManager.UI.ShowNStackPopup<NagariPopup>(EPopupType.NagariPopup);
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_prevScore_Player = score;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int score = GetTotalScore(false, false);
|
|||
|
|
int handNumber = GetMatchedCardSlotNumber(ECardLocationType.AI_Hand);
|
|||
|
|
|
|||
|
|
if (score >= 7)
|
|||
|
|
{
|
|||
|
|
if (AI_Go <= 0)
|
|||
|
|
{
|
|||
|
|
if (handNumber <= 0)
|
|||
|
|
{
|
|||
|
|
GameOver = true;
|
|||
|
|
yield return EffectPanel.Direct(EEffectDirectType.Stop, PlayerTurn);
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GameManager.UI.ShowNStackPopup<WaitForAIBehaviourPopup>(EPopupType.WaitForAIBehaviourPopup).SetData(1f);
|
|||
|
|
|
|||
|
|
yield return _waitforSecondsZeroDotOne;
|
|||
|
|
yield return new WaitUntil(() => GameManager.UI.IsOpendPopup(EPopupType.WaitForAIBehaviourPopup) == false);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GO<47><4F> Stop<6F><70> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
// 난이도 상승을 위해서는 고 판단을 할 수 있어야 한다.
|
|||
|
|
// 플레이어가 고가 1이상인가
|
|||
|
|
// 플레이어의 점수가 5점 이상인가
|
|||
|
|
|
|||
|
|
bool go = false;
|
|||
|
|
int playerScore = GetTotalScore(true, false);
|
|||
|
|
|
|||
|
|
if (Player_Go >= 1 || playerScore >= 5)
|
|||
|
|
{
|
|||
|
|
go = false;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
go = Random.Range(0, 2) == 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (go)
|
|||
|
|
{
|
|||
|
|
AI_Go++;
|
|||
|
|
yield return EffectPanel.GoDirect(AI_Go, false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GameOver = true;
|
|||
|
|
yield return new WaitForSeconds(EffectPanel.Direct(EEffectDirectType.Stop, PlayerTurn));
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (GameOver)
|
|||
|
|
yield break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (score > _prevScore_AI)
|
|||
|
|
{
|
|||
|
|
if (handNumber > 0)
|
|||
|
|
{
|
|||
|
|
GameManager.UI.ShowNStackPopup<WaitForAIBehaviourPopup>(EPopupType.WaitForAIBehaviourPopup).SetData(1f);
|
|||
|
|
|
|||
|
|
yield return _waitforSecondsZeroDotOne;
|
|||
|
|
yield return new WaitUntil(() => GameManager.UI.IsOpendPopup(EPopupType.WaitForAIBehaviourPopup) == false);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GO<47><4F> Stop<6F><70> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
bool go = false;
|
|||
|
|
int playerScore = GetTotalScore(true, false);
|
|||
|
|
|
|||
|
|
if (Player_Go >= 1 || playerScore >= 5)
|
|||
|
|
{
|
|||
|
|
go = false;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
go = Random.Range(0, 2) == 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (go)
|
|||
|
|
{
|
|||
|
|
AI_Go++;
|
|||
|
|
yield return EffectPanel.GoDirect(AI_Go, false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GameOver = true;
|
|||
|
|
yield return EffectPanel.Direct(EEffectDirectType.Stop, PlayerTurn);
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (GameOver)
|
|||
|
|
yield break;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
yield return EffectPanel.Direct(EEffectDirectType.Stop, true);
|
|||
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(false);
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int centerNumber = GetMatchedCardSlotNumber(ECardLocationType.Center);
|
|||
|
|
|
|||
|
|
if (handNumber <= 0)
|
|||
|
|
{
|
|||
|
|
yield return StartCoroutine(EffectPanel.NagariEffect());
|
|||
|
|
GameManager.UI.ShowNStackPopup<NagariPopup>(EPopupType.NagariPopup);
|
|||
|
|
GameOver = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_prevScore_AI = score;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!GameOver)
|
|||
|
|
{
|
|||
|
|
ChangeTurn();
|
|||
|
|
|
|||
|
|
CurrentCoroutineType = EGameWorkFlowType.DiscardNEffectBeforeDiscard;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Methods
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void ChangeTurn()
|
|||
|
|
{
|
|||
|
|
if (PlayerTurn)
|
|||
|
|
_isFirstTurn_Player = false;
|
|||
|
|
else
|
|||
|
|
_isFirstTurn_AI = false;
|
|||
|
|
|
|||
|
|
PlayerTurn = !PlayerTurn;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
GPT <EFBFBD><EFBFBD>ũ<EFBFBD>÷ο<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
private IEnumerator coroMain()
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ī<><C4AB> <20>й<EFBFBD>
|
|||
|
|
yield return StartCoroutine(coroDistributeCard());
|
|||
|
|
// ī<><C4AB> <20>й<EFBFBD> <20><> <20>ʿ<EFBFBD><CABF><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD>ŭ <20><><EFBFBD>
|
|||
|
|
yield return new WaitForSeconds(1.0f);
|
|||
|
|
|
|||
|
|
// <20>÷<EFBFBD><C3B7>̾<EFBFBD> ī<><C4AB> <20><><EFBFBD><EFBFBD>
|
|||
|
|
this.SortPlayerCards();
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ݺ<EFBFBD>
|
|||
|
|
while (!GameOver)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7>̾<EFBFBD><CCBE><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD> AI)
|
|||
|
|
yield return StartCoroutine(coroPlayerTurn());
|
|||
|
|
|
|||
|
|
// <20>÷<EFBFBD><C3B7>̾ ī<>带 <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
ECardType selectedCard = this.SelectCard();
|
|||
|
|
yield return StartCoroutine(coroDiscard(selectedCard));
|
|||
|
|
|
|||
|
|
// <20>ٴ<EFBFBD><D9B4>п<EFBFBD> <20><>Ī<EFBFBD><C4AA> ī<><C4AB> ó<><C3B3>
|
|||
|
|
yield return StartCoroutine(coroMatchAndCollectCards(selectedCard));
|
|||
|
|
|
|||
|
|
// <20>߾<EFBFBD> ī<>嵦<EFBFBD><E5B5A6><EFBFBD><EFBFBD> ī<><C4AB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
yield return StartCoroutine(coroFlipCenterCard());
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ھ<DABE><EEBAB8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ: <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
|
|||
|
|
this.UpdateScoreboard();
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7<><37> <20>̻<EFBFBD><CCBB><EFBFBD> <20><><EFBFBD> '<27><>' <20>Ǵ<EFBFBD> '<27><>ž' <20><><EFBFBD><EFBFBD>
|
|||
|
|
if (currentScore >= 7)
|
|||
|
|
{
|
|||
|
|
yield return StartCoroutine(coroChooseGoOrStop());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE>
|
|||
|
|
if (IsGameOver())
|
|||
|
|
{
|
|||
|
|
GameOver = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20>ѱ<EFBFBD><D1B1>
|
|||
|
|
this.ChangeTurn();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: <20><><EFBFBD> ǥ<><C7A5>
|
|||
|
|
this.ShowGameOver();
|
|||
|
|
yield return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>õ<EFBFBD> ī<>忡 <20><><EFBFBD><EFBFBD> <20>ٴ<EFBFBD><D9B4>п<EFBFBD> <20><>Ī<EFBFBD>Ǵ<EFBFBD> ī<>带 <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>ڷ<EFBFBD>ƾ
|
|||
|
|
private IEnumerator coroMatchAndCollectCards(ECardType selectedCard)
|
|||
|
|
{
|
|||
|
|
// <20><>Ī <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>...
|
|||
|
|
// <20><>Ī<EFBFBD><C4AA> ī<><C4AB> <20><><EFBFBD><EFBFBD> <20><> ó<><C3B3> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>...
|
|||
|
|
yield return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20>÷<EFBFBD><C3B7>̾ '<27><>' <20>Ǵ<EFBFBD> '<27><>ž'<27><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>ڷ<EFBFBD>ƾ
|
|||
|
|
private IEnumerator coroChooseGoOrStop()
|
|||
|
|
{
|
|||
|
|
// '<27><>' <20>Ǵ<EFBFBD> '<27><>ž' <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>...
|
|||
|
|
yield return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><>Ÿ <20>ʿ<EFBFBD><CABF><EFBFBD> <20>ڷ<EFBFBD>ƾ<EFBFBD><C6BE> <20>ҵ<DEBC> <20><><EFBFBD><EFBFBD>...
|
|||
|
|
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
|
|||
|
|
|
|||
|
|
// ... <20><><EFBFBD><EFBFBD> <20>ڵ<EFBFBD> ...
|
|||
|
|
|
|||
|
|
// <20>߾<EFBFBD> ī<>嵦<EFBFBD><E5B5A6><EFBFBD><EFBFBD> ī<><C4AB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
yield return StartCoroutine(coroFlipCenterCard());
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ī<><C4AB><EFBFBD> <20>ٴ<EFBFBD><D9B4><EFBFBD> <20><>Ī <20>˻<EFBFBD>
|
|||
|
|
yield return StartCoroutine(coroCheckMatchAfterFlip());
|
|||
|
|
|
|||
|
|
// <20><>Ī<EFBFBD><C4AA> <20><><EFBFBD> <20>ش<EFBFBD><D8B4>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
if (IsMatched)
|
|||
|
|
{
|
|||
|
|
yield return StartCoroutine(coroPerformMatchedAction());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ھ<DABE><EEBAB8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ: <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
|
|||
|
|
this.UpdateScoreboard();
|
|||
|
|
|
|||
|
|
// ... <20>ļ<EFBFBD> <20>ڵ<EFBFBD> ...
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ī<><C4AB><EFBFBD> <20>ٴ<EFBFBD><D9B4><EFBFBD> <20><>Ī <20>˻<EFBFBD> <20>ڷ<EFBFBD>ƾ
|
|||
|
|
private IEnumerator coroCheckMatchAfterFlip()
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ī<><C4AB><EFBFBD> <20>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD> <20><>Ī <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>...
|
|||
|
|
yield return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><>Ī<EFBFBD><C4AA> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>ڷ<EFBFBD>ƾ
|
|||
|
|
private IEnumerator coroPerformMatchedAction()
|
|||
|
|
{
|
|||
|
|
// <20><>, <20>ڻ<EFBFBD>, <20><><EFBFBD>Ա<EFBFBD>, <20>ڻ<EFBFBD><DABB>Ա<EFBFBD>, <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>...
|
|||
|
|
yield return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
*/
|