/* * /// <summary> * /// 行動処理 * /// </summary> * /// <returns></returns> * private IEnumerator Turn() { * * //二人のプレイヤーの情報を取得 * PlayerStates = new PlayerState[2] { * new PlayerState(player), * new PlayerState(Constants.BATTLE.GetOtherPlayer(player)) * }; * * while (Constants.BATTLE.GetActivePlayer() == player) { * switch (Constants.BATTLE.GetTurnPhase()) { * case GamePhase.draft: * yield return StartCoroutine(DraftPhase()); * break; * case GamePhase.main: * //yield return StartCoroutine(MainPhase()); * yield return new WaitForSeconds(1.0f); * yield return StartCoroutine(second_AI.Think());//テスト用AI * Constants.BATTLE.TurnEnd(); * while (Constants.BATTLE.GetTurnPhase() == GamePhase.main) * yield return null; * break; * case GamePhase.handDest: * yield return StartCoroutine(HandDestPhase()); * break; * default: * yield return null; * break; * } * yield return null; * } * Debug.Log("TurnEnd:" + gameObject); * } */ /// <summary> /// ドラフトの処理 /// </summary> /// <returns></returns> public IEnumerator DraftPhase() { while (Constants.BATTLE.Field.GetDraftZone().GetCards().Count == 0) { yield return(null); } yield return(new WaitForSeconds(1.5f)); CardPoint selectCard = null; List <CardPoint> cards = new List <CardPoint>(); foreach (Card c in Constants.BATTLE.Field.GetDraftZone().GetCards()) { cards.Add(new CardPoint() { card = c, point = GetPoint(PlayerStates[0].player, c, CardZoneType.Hand), zone = CardZoneType.Draft }); } foreach (CardPoint cp in cards) { if (selectCard == null || (player.AligmentCheck(cp.card.State.cardAligment) && cp.point > selectCard.point)) { selectCard = cp; } } //if (selectCard == null) selectCard = draft[0]; Constants.BATTLE.DraftDraw(selectCard.card); while (Constants.BATTLE.GetTurnPhase() == GamePhase.draft) { yield return(null); } }
public void OnPressShowPokerBtn() { // if (!ReadyState && PlayerType == 3) return; //没有参与游戏,不显示 if (UserBetPoker.CantShowPoint) { return; //没有发牌,不显示 } CardPoint.SetOpenCardsPoint(SelfAllCardPoint); CardPoint.ShowDifPointLabel(); UserBetPoker.ShowPokerValue(); }
public void SwipePointTrigger(CardPoint swipePoint) { if (swipePoint == _swipePoints[_currentSwipePointIndex]) { _currentSwipePointIndex++; _countdown = _countdownMax; } if (_currentSwipePointIndex >= _swipePoints.Count) { _currentSwipePointIndex = 0; StartCoroutine(FinishTask(true)); } }
public override bool ActionEnter() { if (card.State.cardType == ObjectType.Unit) { if (!player.GetUnitZone().isAddCard()) { AIScript.PlayerState state = player.GetComponent <AIScript>().PlayerStates[0]; CardPoint dispCard = null; foreach (CardPoint unitCard in state.Unit) { if (point > unitCard.point && (dispCard == null || dispCard.point > unitCard.point)) { dispCard = unitCard; } } if (dispCard != null) { dispCard.card.Disp(); } } } else if (card.State.cardType == ObjectType.Support || card.State.cardType == ObjectType.Trap) { if (!player.GetSupportZone().isAddCard()) { AIScript.PlayerState state = player.GetComponent <AIScript>().PlayerStates[0]; CardPoint dispCard = null; foreach (CardPoint supportCard in state.Support) { if (point > supportCard.point && (dispCard == null || dispCard.point > supportCard.point)) { dispCard = supportCard; } } if (dispCard != null) { dispCard.card.Disp(); } } } if (card.State.isTargetSelect()) { player.GetComponent <AIScript>().GetPoint(player, card, CardZoneType.Hand, ref target); Debug.Log(card.State.cardName + " 行動対象 " + target); } return(player.CardPlay(card, target)); }
/// <summary> /// 攻撃対象を取得する処理 /// </summary> /// <returns></returns> public GameObject GetAttackTarget() { List <CardPoint> points = new List <CardPoint>(); CardPoint point = null; GameObject target = null; foreach (CardPoint c in PlayerStates[1].Unit) { if (c.card.State.defence <= player.AttackPower) { /*if (c.card.GetComponent<IAttackTarget>().GetTargetPriority() > Constants.TARGET_NOMAL) * points.Add(c);*/ if (Constants.BATTLE.IsAttackTarget(c.card.gameObject)) { points.Add(c); } } } for (int i = 0; i < points.Count; i++) { if (point == null) { point = points[i]; } else if (point.point < points[i].point) { point = points[i]; } } if (point != null) { target = point.card.gameObject; } //if (Constants.BATTLE.IsAttackTarget(Constants.BATTLE.GetOtherPlayer(player).gameObject)) if (player.AttackPower - Constants.BATTLE.GetOtherPlayer(player).Defence > 0 && (target == null || (player.AttackPower - Constants.BATTLE.GetOtherPlayer(player).Defence) * AIConstants.LIFE_POINT > point.point)) { target = Constants.BATTLE.GetOtherPlayer(player).gameObject; } return(target); }
/* * /// <summary> * /// カードの使用順序並び替え * /// </summary> * /// <returns></returns> * private List<Card> PlayListSort(List<Card> cards) { * List<Card> sort = new List<Card>(cards); * * bool isContinue = false; * do { * isContinue = false; * for (int i = 0; i < sort.Count; i++) * { * for (int j = i + 1; j < sort.Count; j++) * { * if (isPriority(sort[i], sort[j]) > 0) { * Debug.Log("CardChange to " + sort[i] + ":" + sort[j]); * Card c = sort[i]; * sort[i] = sort[j]; * sort[j] = c; * isContinue = true; * } * } * } * } while (isContinue); * * card = sort; * * return sort; * }*/ /// <summary> /// カードを評価点順に並び替える処理 /// </summary> /// <param name="cards"></param> private void PlayListSort_CardPoint(List <CardPoint> cards) { bool isContinue = false; do { isContinue = false; for (int i = 0; i < cards.Count; i++) { for (int j = i + 1; j < cards.Count; j++) { if (isPriority(cards[i].card, cards[j].card) > 0) { //Debug.Log("CardChange to " + cards[i] + ":" + cards[j]); CardPoint c = cards[i]; cards[i] = cards[j]; cards[j] = c; isContinue = true; } } } } while (isContinue); }
public PokerCard(CardPoint point, CardColor color) { Point = point; Color = color; }
public void SetCard(CardPoint point, CardColor color) { Point = point; Color = color; }
public void OnReleaseShowPokerBtn() { CardPoint.SetOpenCardsPoint(OpenCardPoint); CardPoint.ShowDifPointLabel(); UserBetPoker.HidePokerValue(); }