Exemplo n.º 1
0
 public void SetReserveCard(eCards _color, int _num, eSpecialCard _special)
 {
     reserveCard               = new CardData();
     reserveCard.myColor       = _color;
     reserveCard.myNumCard     = _num;
     reserveCard.mySpecialCard = _special;
 }
Exemplo n.º 2
0
 private void NeedActivateBonus(BonusSlot _bonusSlot, bool imageEnable)
 {
     currentActivSlot = _bonusSlot;
     currentBonus     = currentActivSlot.GetBonus();
     currentActivSlot.ActivateBackImageCard(imageEnable);
     isNeedActivateBonus = true;
 }
Exemplo n.º 3
0
 public void InitCardInCellWithCheckClosed(int _color, int _num, eSpecialCard _specialCard, bool isClosed)
 {
     if (_num == 0 || _color == 0)
     {
         imageCell.enabled = false;
         imageFlashing.gameObject.SetActive(false);
         Info.IsFull = false;
         myCard.ClearFromCell();
         return;
     }
     imageCell.enabled = true;
     imageFlashing.gameObject.SetActive(false);
     Info.IsFull = true;
     if (!isClosed)
     {
         myCard.SetClosed(false);
         string path = myCard.InitCard(_color, _num, _specialCard);
         particleMat.material.mainTexture = Resources.Load <Texture>(path);
     }
     else
     {
         string path = myCard.InitClosed();
         myCard.InitInfoCard(_color, _num, _specialCard);
         particleMat.material.mainTexture = Resources.Load <Texture>(path);
     }
     myCard.InitCoordinate(Info.myX, Info.myY);
 }
Exemplo n.º 4
0
 public void InitSlot(eSpecialCard _bonus)
 {
     /*
      * if (!isFull)
      * {
      *  myBonus = _bonus;
      *  isFull = true;
      * }
      * else
      * {
      *  if (_bonus.ToString().Contains("upend") || myBonus.ToString().Contains("bullet") || myBonus.ToString().Contains("fireworks") || myBonus.ToString().Contains("wind"))
      *  {
      *      int curentLevel = (int)myBonus;
      *      if (curentLevel >= (int)_bonus)
      *      {
      *          curentLevel++;
      *          myBonus = (eSpecialCard)curentLevel;
      *      }
      *      else
      *      {
      *          myBonus = _bonus;
      *      }
      *  }
      *  else
      *  {
      *      myBonus = _bonus;
      *  }
      * }
      */
     myCard.AnimatorDesable();
     ActivateBackImageCard(false);
     myBonus = _bonus;
     isFull  = true;
     myCard.InitBonusInfo(myBonus);
 }
Exemplo n.º 5
0
 private void OnTriggerEnter2D(Collider2D obj)
 {
     if (tag == "special")
     {
         HexagonalCell _cell = obj.GetComponent <HexagonalCell>();
         if (_cell != null && _cell.GetIsFull())
         {
             eSpecialCard currentBonus = BonusManager.Instance.GetCurrentActivSlot().GetBonus();
             int          step         = 0;
             if (currentBonus == eSpecialCard.wind1)
             {
                 step = 1;
             }
             if (currentBonus == eSpecialCard.wind2)
             {
                 step = 2;
             }
             if (currentBonus == eSpecialCard.wind3)
             {
                 step = 3;
             }
             if (step == 0)
             {
                 return;
             }
             StopCoroutine("MoveNewPosition");
             imageCard.transform.localPosition = Vector3.zero;
             HexagonalGrid.Instance.WindFallNearCard(_cell.Info.myX, _cell.Info.myY, step);
             BonusManager.Instance.ClearCurrentBonusSlot();
             ManagerCombination.Instance.ClearMatchCells();
             FindObjectOfType <ActivCardMoving>().SetEnableImageCard(true);
         }
     }
 }
Exemplo n.º 6
0
 public void AppearanceInit(int color, int num, eSpecialCard _specialCard)
 {
     myCard.imageCard.raycastTarget = true;
     myCard.InitCard(color, num, _specialCard);
     RestartCard();
     myCard.StartAppearanceCard();
 }
Exemplo n.º 7
0
        public void InitInfoCard(int _color, int _num, eSpecialCard _specialCard)
        {
            eCards _Mycolor = (eCards)_color;

            Info.myColor       = _Mycolor;
            Info.myNumCard     = _num;
            Info.mySpecialCard = _specialCard;
        }
Exemplo n.º 8
0
 public void ClearSlot()
 {
     BonusManager.Instance.ClearCurrentActivSlot();
     activCard.SetEnableImageCard(true);
     myCard.AnimatorDesable();
     ActivateBackImageCard(false);
     isFull  = false;
     myBonus = eSpecialCard.none;
     myCard.ClearFromCell();
 }
Exemplo n.º 9
0
        public void InitCardInCell(int _color, int _num, eSpecialCard _specialCard)
        {
            imageCell.enabled = true;
            imageFlashing.gameObject.SetActive(false);
            Info.IsFull = true;
            string path = myCard.InitCard(_color, _num, _specialCard);

            particleMat.material.mainTexture = Resources.Load <Texture>(path);
            myCard.InitCoordinate(Info.myX, Info.myY);
        }
Exemplo n.º 10
0
    public void Init(eSpecialCard _special)
    {
        Color _color = bonus.color;

        _color.a    = 1;
        bonus.color = _color;
        mySpecial   = _special;
        InitBonusInfo(_special);
        StartCoroutine("ActivateChest");
    }
Exemplo n.º 11
0
 private void InitCard(eCards _color, int _num, eSpecialCard _spec)
 {
     canReplacement            = true;
     canSwap                   = true;
     myCard.Info.myColor       = _color;
     myCard.Info.myNumCard     = _num;
     myCard.Info.mySpecialCard = _spec;
     myCard.InitCard((int)myCard.Info.myColor, myCard.Info.myNumCard, myCard.Info.mySpecialCard);
     myCard.ActivateImageBack(false);
     activCard.myCard.ActivateImageBack(false);
 }
Exemplo n.º 12
0
 public string InitCard(int _color, int _num, eSpecialCard _specialCard)
 {
     if (tag == "CellLevel")
     {
         StopAllCoroutines();
         imageCard.transform.localEulerAngles = Vector3.zero;
         imageCard.transform.localPosition    = Vector3.zero;
         imageCard.transform.localScale       = Vector3.one;
     }
     InitInfoCard(_color, _num, _specialCard);
     return(InitBonusInfo(Info.mySpecialCard));
 }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     activCard = FindObjectOfType <ActivCardMoving>();
     myCard    = transform.GetComponentInChildren <Card>();
     myButton  = GetComponent <Button>();
     myButton.onClick.AddListener(ActivateBonus);
     if (LoadManager.Instance.needLoad)
     {
         string saveBonus = PlayerPrefs.GetString(name);
         if (!string.IsNullOrEmpty(saveBonus))
         {
             eSpecialCard saveSpecialCard = (eSpecialCard)Enum.Parse(typeof(eSpecialCard), saveBonus);
             InitSlot(saveSpecialCard);
         }
     }
 }
Exemplo n.º 14
0
    public void InitBonusInfo(eSpecialCard _specialCard)
    {
        string path = "";

        bonus.transform.localPosition = Vector3.zero;
        if (animator == null)
        {
            animator = bonus.GetComponent <Animator>();
        }
        animator.enabled = false;
        if (_specialCard == eSpecialCard.Joker)
        {
            int rand = Random.Range(0, 4);
            path = "Card/Special/" + _specialCard.ToString() + rand.ToString();
        }
        else if (_specialCard == eSpecialCard.chameleon)
        {
            int rand = Random.Range(1, 3);
            path = "Card/Special/" + _specialCard.ToString() + rand.ToString();
        }
        else if (_specialCard == eSpecialCard.wind1)
        {
            if (animator != null)
            {
                animator.enabled = true;
                animator.Play("Wind1");
            }
            return;
        }
        else if (_specialCard == eSpecialCard.wind2)
        {
            if (animator != null)
            {
                animator.enabled = true;
                animator.Play("Wind2");
            }
            return;
        }
        else
        {
            path = "Card/Special/" + _specialCard.ToString();
        }
        Sprite _sprite = Resources.Load <Sprite>(path);

        bonus.sprite = _sprite;
    }
Exemplo n.º 15
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");
        }
    }
Exemplo n.º 16
0
    public void PlayBonusStart(eSpecialCard _bonus, bool isStart)
    {
        string path  = "Audio/";
        string bonus = _bonus.ToString();

        if (isStart)
        {
            path += "Start/";
        }
        else
        {
            path += "Go/";
        }

        if (bonus.Contains("upend"))
        {
            bonus = "upend";
        }
        else if (bonus.Contains("wind"))
        {
            bonus = "wind";
        }
        else if (bonus.Contains("bullet"))
        {
            bonus = "bullet";
        }
        else if (bonus.Contains("fireworks"))
        {
            bonus = "fireworks";
        }
        AudioClip _clip = Resources.Load <AudioClip>(path + bonus);

        if (_clip != null)
        {
            allSound.PlayOneShot(_clip);
        }
    }
Exemplo n.º 17
0
 private BonusSlot GetSameBonusInSlot(eSpecialCard _bonus)
 {
     for (int i = 0; i < bonusSlots.Length; i++)
     {
         eSpecialCard currentBonus = bonusSlots[i].GetBonus();
         if (_bonus.ToString().Contains("upend") && currentBonus.ToString().Contains("upend"))
         {
             if (currentBonus != eSpecialCard.upend4)
             {
                 return(bonusSlots[i]);
             }
         }
         if (_bonus.ToString().Contains("bullet") && currentBonus.ToString().Contains("bullet"))
         {
             if (currentBonus != eSpecialCard.bullet5)
             {
                 return(bonusSlots[i]);
             }
         }
         if (_bonus.ToString().Contains("fireworks") && currentBonus.ToString().Contains("fireworks"))
         {
             if (currentBonus != eSpecialCard.fireworks3)
             {
                 return(bonusSlots[i]);
             }
         }
         if (_bonus.ToString().Contains("wind") && currentBonus.ToString().Contains("wind"))
         {
             if (currentBonus != eSpecialCard.wind3)
             {
                 return(bonusSlots[i]);
             }
         }
     }
     return(null);
 }
Exemplo n.º 18
0
 public void SwapSlot(eSpecialCard _bonus)
 {
     myBonus = _bonus;
     isFull  = true;
     myCard.InitBonusInfo(myBonus);
 }
Exemplo n.º 19
0
        public string InitBonusInfo(eSpecialCard _specialCard)
        {
            string path = "Card/" + Info.myColor.ToString() + "/" + Info.myNumCard.ToString();

            if (_specialCard != eSpecialCard.none)
            {
                if (_specialCard == eSpecialCard.Joker)
                {
                    int rand = Random.Range(0, 4);
                    path = "Card/Special/" + _specialCard.ToString() + rand.ToString();
                }
                else if (_specialCard == eSpecialCard.chameleon)
                {
                    int rand = Random.Range(1, 3);
                    path = "Card/Special/" + _specialCard.ToString() + rand.ToString();
                }
                else if (_specialCard == eSpecialCard.wind1)
                {
                    if (animator != null)
                    {
                        animator.enabled = true;
                        animator.Play("Wind1");
                    }
                    imageCard.enabled = true;
                    return(null);
                }
                else if (_specialCard == eSpecialCard.wind2)
                {
                    if (animator != null)
                    {
                        animator.enabled = true;
                        animator.Play("Wind2");
                    }
                    imageCard.enabled = true;
                    return(null);
                }
                else
                {
                    path = "Card/Special/" + _specialCard.ToString();
                }
            }
            Sprite _sprite = Resources.Load <Sprite>(path);

            if (_sprite != null)
            {
                imageCard.enabled = true;
                imageCard.sprite  = _sprite;
                textCard.text     = "";
            }
            else
            {
                imageCard.enabled = false;
                if (_specialCard == eSpecialCard.none)
                {
                    textCard.text = "";
                }
                else
                {
                    textCard.text = _specialCard.ToString();
                }
            }
            return(path);
        }
Exemplo n.º 20
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);
        }
    }