Exemple #1
0
    private void PlayEliminate()
    {
        FuncEliminate.Eliminate();

        List <List <CellAnimInfo> >    cellAnims    = CellModel.Instance.anims;
        List <List <FloorAnimInfo> >   floorAnims   = FloorModel.Instance.anims;
        List <List <WallAnimInfo> >    wallAnims    = WallModel.Instance.anims;
        List <List <CoverAnimInfo> >   coverAnims   = CoverModel.Instance.anims;
        List <List <MonsterAnimInfo> > monsterAnims = MonsterModel.Instance.anims;

        rootAction = new OrderAction();
        for (int i = 0; i < cellAnims.Count; i++)
        {
            ParallelAction paralle = new ParallelAction();

            List <CellAnimInfo> cellAnimss = cellAnims[i];
            int j;
            for (j = 0; j < cellAnimss.Count; j++)
            {
                CellAnimInfo  animInfo = cellAnimss[j];
                FightCellItem item     = GetItemByRunId(animInfo.runId);
                if (item == null && animInfo.animationType != CellAnimType.nullbomb)
                {
                    continue;                    //todo不因该有这个判断 变色技能需要再研究
                }

                OrderAction order = new OrderAction();

                switch (animInfo.animationType)
                {
                case CellAnimType.clear:
                    order.AddNode(new PlaySoundActor("clear"));
                    order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f));
                    FightEffectItem effectItem = effectLayer.GetEffectItemByPos(animInfo.toInfo.posX, animInfo.toInfo.posY);
                    order.AddNode(new ShowBombActor(item, effectItem, false));
                    order.AddNode(new ShowEffectActor(item.transform, "effect_cell_clear", fightModule.transform));
                    order.AddNode(new DestroyActor(item.gameObject));
                    break;

                case CellAnimType.wreck:
                    order.AddNode(new PlaySoundActor("wreck"));
                    order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f));
                    effectItem = effectLayer.GetEffectItemByPos(animInfo.toInfo.posX, animInfo.toInfo.posY);
                    order.AddNode(new ShowBombActor(item, effectItem, false));
                    order.AddNode(new ShowEffectActor(item.transform, "effect_cell_bomb", fightModule.transform));
                    order.AddNode(new ChangeCellActor(item, animInfo.toInfo));
                    if (animInfo.toInfo.isBlank)
                    {
                        order.AddNode(new DestroyActor(item.gameObject));
                    }
                    break;

                case CellAnimType.bomb:
                    order.AddNode(new PlaySoundActor("wreck"));
                    order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1.2f, 1.2f, 1), 0.1f));
                    effectItem = effectLayer.GetEffectItemByPos(animInfo.toInfo.posX, animInfo.toInfo.posY);
                    order.AddNode(new ShowBombActor(item, effectItem, false));
                    order.AddNode(new ShowEffectActor(item.transform, "effect_cell_bomb", fightModule.transform));
                    order.AddNode(new ChangeCellActor(item, animInfo.toInfo));
                    if (animInfo.toInfo.isBlank)
                    {
                        order.AddNode(new DestroyActor(item.gameObject));
                    }
                    break;

                case CellAnimType.nullbomb:
                    effectItem = effectLayer.GetEffectItemByPos(animInfo.toInfo.posX, animInfo.toInfo.posY);
                    order.AddNode(new ShowBombActor(item, effectItem, false));
                    break;
                }

                if (item != null && item.cell_info.isBlank)
                {
                    if (item.cell_info.timer > 0)
                    {
                        order.AddNode(new AddStepActor(item.cell_info.addCount));
                        order.AddNode(new WaitActor(200));
                    }
                }

                paralle.AddNode(order);
            }

            floorLayer.PlayEliminate(floorAnims[i], paralle);
            coverLayer.PlayEliminate(coverAnims[i], paralle);
            fancelayer.PlayEliminate(wallAnims[i], paralle);
            monsterLayer.PlayEliminate(monsterAnims[i], paralle);

            rootAction.AddNode(paralle);
        }

        ExecuteAction(FightStadus.eliminate);
    }