示例#1
0
    private void CardTurnAction()
    {
        if (m_CurrentTurnCard != null)
        {
            int selectedSlot = -1;
            if (m_CurrentTurnCard.CurrentCardStatus == CharacterCard.CardStatus.Idle)
            {
                if (!m_IsBattleAutomatic)
                {
                    if (m_CurrentTurnCard.IsPlayerTeam)
                    {
                        bool    isMouseButtonPressed = Input.GetMouseButtonUp(0);
                        Vector3 mousePosition        = Camera.main.ScreenToWorldPoint(Input.mousePosition);

                        m_CurrentTurnCard.OnCardInAction();
                        for (int i = 0; i < m_EnemyCardList.Count; ++i)
                        {
                            mousePosition.z = m_EnemyCardList[i].transform.position.z;
                            if (m_EnemyCardList[i].IsContainPoint(ref mousePosition))
                            {
                                m_EnemyCardList[i].OnCardSelectedInTarget();
                                if (isMouseButtonPressed)
                                {
                                    selectedSlot = i;
                                    m_CurrentTurnCard.ForceQuitVisualizeEffect();
                                    break;
                                }
                            }
                            else
                            {
                                m_EnemyCardList[i].ForceQuitVisualizeEffect();
                            }
                        }
                    }
                    else
                    {
                        selectedSlot = m_GetAttackSlotIndexConnector(!m_CurrentTurnCard.IsPlayerTeam);
                        m_CurrentTurnCard.ForceQuitVisualizeEffect();
                    }
                }
                else
                {
                    selectedSlot = m_GetAttackSlotIndexConnector(!m_CurrentTurnCard.IsPlayerTeam);
                    m_CurrentTurnCard.ForceQuitVisualizeEffect();
                }

                OnAttack(selectedSlot);
            }

            GoingToNextTurn();
        }
    }