Esempio n. 1
0
 private void NeedActivateBonus(BonusSlot _bonusSlot, bool imageEnable)
 {
     currentActivSlot = _bonusSlot;
     currentBonus     = currentActivSlot.GetBonus();
     currentActivSlot.ActivateBackImageCard(imageEnable);
     isNeedActivateBonus = true;
 }
Esempio n. 2
0
    public void BuyBonus(int _bonus)
    {
        BonusSlot _freeSlot = GetFreeBonusSlot();

        if (_freeSlot != null)
        {
            _freeSlot.InitSlot((eSpecialCard)_bonus);
        }
    }
Esempio n. 3
0
 public void SetCellOnClick(HexagonalCell _cell)
 {
     if (isNeedActivateBonus)
     {
         if (currentActivSlot != null)
         {
             currentActivSlot.ActivateBackImageCard(false);
         }
         isNeedActivateBonus = false;
         MechanicsBonuses(_cell);
     }
     else
     {
         currentActivSlot = null;
     }
 }
Esempio n. 4
0
    public void OnEndDrag(PointerEventData eventData)
    {
        bonus.raycastTarget = true;
        var obj = eventData.pointerCurrentRaycast;

        if (obj.gameObject.name == "ImageCell")
        {
            BonusSlot _slot = obj.gameObject.transform.parent.GetComponent <BonusSlot>();
            if (_slot != null)
            {
                _slot.SwapSlot(mySpecial);
                //      StopCoroutine("DeactivateTransparent");
                //     CancelInvoke("Deactivate");
                gameObject.SetActive(false);
            }
        }
    }
Esempio n. 5
0
    public void CreateBonus(HexagonalCell _cell, CombinationData _combination)
    {
        int random = UnityEngine.Random.Range(0, 100);

        if (random > GlobalInfo.changeDropBonus)
        {
            return;
        }

        int          maxNumCard = GetMaxNumCard(_combination);
        string       _combo     = _combination.currentCombination.ToString() + maxNumCard.ToString();
        eSpecialCard _bonus     = GetBonusReward(_combo);

        if (_bonus != eSpecialCard.none)
        {
            BonusItem _items = GetNotActiveBonusItem();
            _items.gameObject.SetActive(true);
            _items.transform.position = _cell.transform.position;
            _items.Init(_bonus);
            BonusSlot _freeslot = GetFreeBonusSlot();
            if (_freeslot != null)
            {
                _items.MoveFreeSlot(_freeslot);
            }
            else
            {
                //  _freeslot = GetSameBonusInSlot(_bonus);
                if (_freeslot != null)
                {
                    _items.MoveFreeSlot(_freeslot);
                }
                else
                {
                    _items.InvokeDeactivate();
                }
            }
        }
        else
        {
            Debug.LogError("_bonus == eSpecialCard.none");
        }
    }
Esempio n. 6
0
 public void ClearCurrentActivSlot()
 {
     isNeedActivateBonus = false;
     currentActivSlot    = null;
 }
Esempio n. 7
0
    public void ActivateBonus(BonusSlot _bonusSlot)
    {
        if (_bonusSlot == null || _bonusSlot.GetBonus() == eSpecialCard.none || activCard.myCard.Info.mySpecialCard != eSpecialCard.none || isNeedActivateBonus)
        {
            return;
        }
        eSpecialCard _currentBonus = _bonusSlot.GetBonus();

        SoundManager.Instance.PlayBonusStart(_currentBonus, true);
        isNeedActivateBonus = false;
        if (_currentBonus == eSpecialCard.Joker || _currentBonus.ToString().Contains("bullet"))
        {
            if (!activCard.GetIsMoving())
            {
                activCard.SetReserveCardToPoll();
                activCard.InitCard(0, 0, _currentBonus);
                _bonusSlot.ClearSlot();
            }
        }
        else if (_currentBonus.ToString().Contains("wind") || _currentBonus.ToString().Contains("fireworks"))
        {
            if (!activCard.GetIsMoving())
            {
                Transform card = _bonusSlot.GetMyCard().GetTransformImageCard();
                Vector3   pos  = activCard.transform.position;
                activCard.SetEnableImageCard(false);
                card.position = pos;
                NeedActivateBonus(_bonusSlot, false);
            }
        }
        else if (_currentBonus == eSpecialCard.upend1 || _currentBonus == eSpecialCard.upend2 || _currentBonus == eSpecialCard.upend3)
        {
            HexagonalCell[] closedCells = HexagonalGrid.Instance.GetAllClosedCard();
            for (int i = 0; i < closedCells.Length; i++)
            {
                closedCells[i].SetFlashingBack(true);
            }
            canUppend = (int)_currentBonus;
            NeedActivateBonus(_bonusSlot, true);
        }
        else if (_currentBonus == eSpecialCard.upend4)
        {
            HexagonalCell[] closedCells = HexagonalGrid.Instance.GetAllClosedCard();
            for (int i = 0; i < closedCells.Length; i++)
            {
                closedCells[i].GetCard().SetIsClosed(false);
            }
            _bonusSlot.ClearSlot();
        }
        else if (_currentBonus == eSpecialCard.hurricane)
        {
            HexagonalGrid.Instance.MixAllCards();
            _bonusSlot.ClearSlot();
        }
        else if (_currentBonus == eSpecialCard.free)
        {
            activCard.SetCanFlight();
            _bonusSlot.ClearSlot();
        }
        else
        {
            NeedActivateBonus(_bonusSlot, true);
        }
    }
Esempio n. 8
0
 public void MoveFreeSlot(BonusSlot slot)
 {
     posMove     = slot.transform.position;
     destination = slot;
     Invoke("InvokeMoveFreeSlot", 1);
 }