예제 #1
0
 public void WarpToDungeon(string name)
 {
     _dungeonLayerIsSelect = _cal.IntParseFast(EventSystem.current.currentSelectedGameObject.name);
     //Debug.Log(_dungeonLayerIsSelect);
     _core.SetTalk(name + " อันตรายมากนะ ระวังด้วยพ่อหนุ่ม");
     _core.CallSubMenu(_SubMenu.Warp, "เจ้าแน่ใจแล้วใช่ไหมที่จะเข้าไป");
 }
        IEnumerator BattleLose(int delay = 1)
        {
            yield return(new WaitForSeconds(delay));

            for (int i = 0; i < _monster.Count; i++)
            {
                int damage = 1;
                if (_monster[i].spriteSet.Contains("hero"))
                {
                    damage = 5;
                }
                for (int a = 0; a < damage; a++)
                {
                    GameObject effect = Instantiate(_hitEffect);
                    effect.transform.SetParent(_monster[i]._avatar.transform);
                    effect.transform.localScale    = new Vector3(1, 1, 1);
                    effect.transform.localPosition = new Vector3(0, 0.5f, 0);
                    yield return(new WaitForSeconds(1.5f));

                    ShowAction("-1", _core._playerHPBar.transform.position);
                    _core._playerHP -= 1;
                }
            }
            _core.CalEscapeRoom();
            yield return(new WaitForSeconds(2));

            if (_core._playerHP == 0)
            {
                _core.CallSubMenu(_SubMenu.GameOver, "Game Over");
            }
            else
            {
                _core.LoadScene(_GameStatus.MAP);
            }
        }
예제 #3
0
    public override void OnPointerClick(PointerEventData data)
    {
        //Debug.Log("Item id " + _item.id);
        _shopPan._itemShopIsSelect = _item;
        _core.SetTalk(_item.item.name + "\n<" + _item.item.detail + ">");
        float currentTimeClick = data.clickTime;

        if (Mathf.Abs(currentTimeClick - lastTimeClick) < 0.75f)
        {
            if (_core._cutscene != null)
            {
                if (_item.itemId == 2)
                {
                    _core._cutscene.GetComponent <Cutscene>().TutorialPlay(_core._subMenuPanel.transform.Find("GridView").Find("BuyButton"));
                }
            }
            _core.CallSubMenu(_SubMenu.Shop);
        }
        lastTimeClick = currentTimeClick;
    }
예제 #4
0
        public override void OnPointerClick(PointerEventData data)
        {
            if (_core._manageHeroPanel.activeSelf)
            {
                return;
            }
            _core.SetTalk(_item.item.name + "\n<" + _item.item.detail + ">");
            if (_core._shopPanel.activeSelf)
            {
                //Debug.Log("Item id " + _item.id);
                _shopPan._itemShopIsSelect = _item;
            }
            else
            {
                _itemCon._itemStoreIdSelect = _item;
            }
            float currentTimeClick = data.clickTime;

            if (Mathf.Abs(currentTimeClick - lastTimeClick) < 0.75f)
            {
                if (_core._cutscene != null)
                {
                    if (_item.itemId == 1)
                    {
                        _core._cutscene.GetComponent <Cutscene>().TutorialPlay(_core._subMenuPanel.transform.Find("GridView").Find("SellButton"));
                    }
                }
                _core._talkPanel.SetActive(false);
                if (_core._gameMode == _GameStatus.BATTLE || _core._gameMode == _GameStatus.CAMP)
                {
                    _itemCon.UseBtn();
                }
                else
                {
                    _core.CallSubMenu(_SubMenu.Item);
                }
            }
            lastTimeClick = currentTimeClick;
        }
 public void ChangeHeroInTeam(int slot)
 {
     if (_heroSwapIsSelect == null || _heroSwapIsSelect.id == 0)
     {
         return;
     }
     //Debug.Log("swap 1 "+ _heroSwapIsSelect.id);
     if (_heroSwapIsSelect.id == -1)
     {
         //Debug.Log("swap 2");
         if (slot == 0 && _core._currentTeamIsSelect == 1)
         {
             //Debug.Log("swap 3");
             _core.CallSubMenu(_SubMenu.Alert, "ไม่สามารถปล่อยให้ตำแหน่งหัวหน้าทีมว่างได้!");
             return;
         }
         //Debug.Log("swap 4");
         _teamList[slot]   = _heroSwapIsSelect;
         _heroSwapIsSelect = null;
         LoadTeamIcon();
         RefeshViewHeroInStore();
     }
     else
     {
         //Debug.Log("swap 5");
         if (_teamList[slot].id == -1)
         {
             //Debug.Log("swap 6");
             bool have = false;
             for (int i = 0; i < _teamList.Count; i++)
             {
                 if (_heroSwapIsSelect.id == _teamList[i].id)
                 {
                     if (i == 0)
                     {
                         _core.CallSubMenu(_SubMenu.Alert, "ไม่สามารถปล่อยให้ตำแหน่งหัวหน้าทีมว่างได้!");
                         return;
                     }
                     HeroStore tmp = _teamList[i];
                     _teamList[i]      = _teamList[slot];
                     _teamList[slot]   = tmp;
                     _heroSwapIsSelect = null;
                     LoadTeamIcon();
                     RefeshViewHeroInStore();
                     have = true;
                     break;
                 }
             }
             if (!have)
             {
                 _teamList[slot]   = _heroSwapIsSelect;
                 _heroSwapIsSelect = null;
                 LoadTeamIcon();
                 RefeshViewHeroInStore();
             }
         }
         else
         {
             //Debug.Log("swap 7");
             if (_teamList[slot].id == _heroSwapIsSelect.id)
             {
             }
             else
             {
                 for (int i = 0; i < _teamList.Count; i++)
                 {
                     if (_teamList[i].id == _heroSwapIsSelect.id)
                     {
                         HeroStore tmp = _teamList[i];
                         _teamList[i]    = _teamList[slot];
                         _teamList[slot] = tmp;
                         break;
                     }
                 }
                 _teamList[slot]   = _heroSwapIsSelect;
                 _heroSwapIsSelect = null;
                 LoadTeamIcon();
                 RefeshViewHeroInStore();
             }
         }
     }
 }