コード例 #1
0
    public IEnumerator onCombine(List <Combine> combines)
    {
        //处理玩法逻辑
        foreach (Combine comb in combines)
        {
            //switch(comb.nextType)
            //{
            //    case ItemsTypes.NONE:
            //        {

            //            break;
            //        }
            //    case ItemsTypes.BOMB:
            //        {

            //            break;
            //        }
            //    case ItemsTypes.HORIZONTAL_STRIPPED:
            //        {

            //            break;
            //        }
            //    case ItemsTypes.VERTICAL_STRIPPED:
            //        {

            //            break;
            //        }
            //    case ItemsTypes.PACKAGE:
            //        {

            //            break;
            //        }
            //    case ItemsTypes.INGREDIENT:
            //        {

            //            break;
            //        }
            //    default:
            //        {
            //            break;
            //        }
            //}

            //if (ItemsTypes.HORIZONTAL_STRIPPED != comb.nextType &&
            //    ItemsTypes.VERTICAL_STRIPPED != comb.nextType)
            {
                Skill skill = SkillFactory.getSkillById(comb.nextType);

                foreach (Item item in comb.items)
                {
                    Debug.Log("ITEM.type = " + item.NextType);
                    Unit attack   = item.square as Unit;
                    Unit defender = SelectAttackTarget();
                    if (defender)
                    {
                        //Skill skill = new Skill();
                        SkillSystem.Instance.UseSkill(attack, defender, skill);
                    }
                }
            }
            //else
            //{
            //EffectMgr.Instance.playSceneEffectByType(comb.nextType);
            //}

            //EffectMgr.Instance.playSceneEffectByType(comb.nextType);

            if (!magic_music)
            {
                magic_music = GameObject.Find("magic_music").GetComponent <AudioSource>();
            }
            if (magic_music)
            {
                magic_music.Stop();
                magic_music.loop = false;
                magic_music.Play();
            }
        }

        yield return(new WaitForSeconds(0.5f));

        foreach (Combine comb in combines)
        {
            foreach (Item item in comb.items)
            {
                item.DestroyItem(false, "", true);
            }
        }
    }