Exemplo n.º 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();
        }
    }
Exemplo n.º 2
0
 private void AttackCardOnSlot(List <CharacterCard> targetList, int attackSlot)
 {
     if (m_CurrentTurnCard.CurrentCardStatus == CharacterCard.CardStatus.Idle)
     {
         CharacterCard cardObject = targetList[attackSlot];
         if (cardObject != null)
         {
             if (cardObject.isActiveAndEnabled && m_CurrentTurnCard.isActiveAndEnabled)
             {
                 if (cardObject.CurrentHealthPoint > 0)
                 {
                     cardObject.ForceQuitVisualizeEffect();
                     m_CurrentTurnCard.AttackCard(cardObject);
                     Debug.Log("Attacked Slot = " + attackSlot);
                     m_ActionListener(OccuredActionState.Attack);
                 }
             }
         }
     }
 }