Beispiel #1
0
    private void PlayPropClear()
    {
        List <List <CellAnimInfo> > cellAnims = CellModel.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);

                OrderAction order = new OrderAction();

                switch (animInfo.animationType)
                {
                case CellAnimType.clear:
                    order.AddNode(new PlaySoundActor("bomb"));
                    order.AddNode(new ShowEffectActor(item.transform, "effect_cell_clear", fightModule.transform));
                    order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f));
                    order.AddNode(new DestroyActor(item.gameObject));
                    break;
                }
                paralle.AddNode(order);
            }
            rootAction.AddNode(paralle);
        }

        ExecuteAction(FightStadus.prop_eliminate);
    }
Beispiel #2
0
    public CellAnimInfo Invade()
    {
        if (blocked == true)
        {
            blocked = false;
            return(null);
        }

        List <CellAnimInfo> waitList = new List <CellAnimInfo>();

        int i;

        for (i = 0; i < CellModel.Instance.allCells.Count; i++)
        {
            List <CellInfo> xCells = CellModel.Instance.allCells[i];
            for (int j = 0; j < xCells.Count; j++)
            {
                CellInfo cellInfo = xCells[j];

                if (cellInfo.isBlank == false && (cellInfo.config.id == invadeId || cellInfo.config.hide_id == invadeId))
                {
                    List <CellInfo> neighbors = CellModel.Instance.GetNeighbors(cellInfo);

                    for (int n = 0; n < neighbors.Count; n++)
                    {
                        CellInfo neighbor = neighbors[n];

                        if (neighbor != null && neighbor.isBlank == false && neighbor.posY >= 0 && CoverModel.Instance.AbsorbLine(neighbor.posX, neighbor.posY) == false)
                        {
                            if (neighbor.config.cell_type == (int)CellType.five && neighbor.isMonsterHold == false)
                            {
                                WallInfo wall = WallModel.Instance.GetWall(cellInfo, neighbor);
                                if (wall.IsNull())
                                {
                                    //Debug.Log("find");
                                    CellAnimInfo cellAnim = new CellAnimInfo();
                                    cellAnim.fromInfo = cellInfo;
                                    cellAnim.toInfo   = neighbor;
                                    waitList.Add(cellAnim);
                                }
                            }
                        }
                    }
                }
            }
        }

        if (waitList.Count > 0)
        {
            int          rangeIndex = Random.Range(0, waitList.Count);
            CellAnimInfo cellAnim   = waitList[rangeIndex];
            cellAnim.toInfo.changer = 0;
            cellAnim.toInfo.SetConfig(invadeId);
            return(cellAnim);
        }
        return(null);
    }
Beispiel #3
0
    private void DeductStep()
    {
        isDeductStep = true;
        bool isSkillDeduct = FuncDeduct.Deduct();

        fightUI.UpdateCollect(true, true);
        fightUI.UpdateCollect(false, true, isSkillDeduct);

        List <List <CellAnimInfo> > cellAnims = CellModel.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)
                {
                    OrderAction order = new OrderAction();

                    FightEffectItem effectItem = effectLayer.FindEffectItemByPos(animInfo.toInfo.posX, animInfo.toInfo.posY);

                    order.AddNode(new ShowBombActor(item, effectItem));
                    order.AddNode(new WaitActor(300));
                    order.AddNode(new ShowBombActor(item, effectItem, false));
                    order.AddNode(new ChangeCellActor(item, animInfo.toInfo));
                    if (animInfo.toInfo.isBlank)
                    {
                        order.AddNode(new ShowEffectActor(item.transform, "effect_cell_clear", fightModule.transform));
                        order.AddNode(new DestroyActor(item.gameObject));
                    }

                    paralle.AddNode(order);
                }
            }
            rootAction.AddNode(new PlaySoundActor("wreck"));
            rootAction.AddNode(paralle);
        }

        ExecuteAction(FightStadus.deduct);
    }
Beispiel #4
0
    public List <CellAnimInfo> EffectInvade()
    {
        List <CellAnimInfo> cellInvades = new List <CellAnimInfo>();

        for (int i = 0; i < invadeSources.Count; i++)
        {
            InvadeInfo invadeInfo = invadeSources[i];

            int count = 0;

            if (count == 0)
            {
                CellAnimInfo cellInvade = invadeInfo.Invade();

                if (cellInvade != null)
                {
                    cellInvades.Add(cellInvade);
                }
            }
        }

        return(cellInvades);
    }
Beispiel #5
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);
    }
Beispiel #6
0
    //用来排序
    public int CompareTo(object obj)
    {
        CellAnimInfo target = obj as CellAnimInfo;

        return(target.startFrame.CompareTo(startFrame));
    }