Пример #1
0
    public void Flow(ActionTree actionTree)
    {
        FloorModel.Instance.Flow();

        List <FloorAnimInfo> anims = FloorModel.Instance.anims[0];

        for (int i = 0; i < anims.Count; i++)
        {
            FloorAnimInfo animInfo = anims[i];

            FightFloorItem item = GetItemByRunId(animInfo.floorInfo.runId);
            if (item != null)
            {
                ParallelAction paralle = new ParallelAction();

                Vector2 toPos = PosUtil.GetFightCellPos(animInfo.floorInfo.posX, animInfo.floorInfo.posY);
                paralle.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.3f));

                OrderAction orderAction = new OrderAction();

                orderAction.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0.5f, 0.5f, 1), 0.1f));
                orderAction.AddNode(new WaitActor(100));
                orderAction.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.1f));
                paralle.AddNode(orderAction);

                actionTree.AddNode(paralle);
            }
        }
    }
Пример #2
0
    public void InitRoadCrawl()
    {
        CellInfo        centerCell    = CellModel.Instance.GetCellByPos(posX, posY);
        List <CellInfo> cellNeighbors = CellModel.Instance.GetNeighbors(centerCell);
        CellInfo        findCellPoint = null;

        for (int i = 0; i < cellNeighbors.Count; i++)
        {
            CellInfo cellNeighbor = cellNeighbors[i];

            if (cellNeighbor == null)
            {
                continue;
            }

            BattleCellInfo bcellInfo = BattleModel.Instance.crtBattle.GetBattleCellByPos(cellNeighbor.posX, cellNeighbor.posY);
            if (bcellInfo.bg_id != special1)
            {
                continue;
            }

            findCellPoint = cellNeighbor;

            Vector2 fromPos = PosUtil.GetFightCellPos(posX, posY);
            Vector2 toPos   = PosUtil.GetFightCellPos(findCellPoint.posX, findCellPoint.posY);

            rotate = PosUtil.VectorAngle(new Vector2(fromPos.x, fromPos.y), new Vector2(toPos.x, toPos.y)) / FightConst.ROTATE_BASE;

            break;
        }
    }
Пример #3
0
    public void ShowLine(CellInfo cellA, CellInfo cellB)
    {
        GameObject item = list.NewItem();

        item.name = cellA.posX + "_" + cellA.posY + "_" + cellB.posX + "_" + cellB.posY;

        PosUtil.SetFightCellPos(item.transform, cellA.posX, cellA.posY);

        item.transform.Rotate(0, 0, PosUtil.VectorAngle(PosUtil.GetFightCellPos(cellA.posX, cellA.posY), PosUtil.GetFightCellPos(cellB.posX, cellB.posY)));
    }
Пример #4
0
    private void Filling(FightStadus fightState = FightStadus.move, int waitmillisecond = 0)
    {
        CellModel.Instance.anims = new List <List <CellAnimInfo> >();
        FunMove.Move(false, isDeductStep);
        List <CellMoveInfo> moveAnims = CellModel.Instance.moveAnims;

        rootAction = new OrderAction();
        ParallelAction paralle = new ParallelAction();

        Dictionary <int, int> newStartPos = new Dictionary <int, int>();

        for (int i = 0; i < moveAnims.Count; i++)
        {
            CellMoveInfo cellMoveInfo = moveAnims[i];

            OrderAction orderAction = new OrderAction();
            paralle.AddNode(orderAction);

            FightCellItem item = GetItemByRunId(cellMoveInfo.cellInfo.runId);
            if (item == null)
            {
                item = CreateCellItem(cellMoveInfo.cellInfo).GetComponent <FightCellItem>();
                int xKey = (int)cellMoveInfo.paths[0].x;
                if (newStartPos.ContainsKey(xKey))
                {
                    int preIndex = newStartPos[xKey];
                    newStartPos[xKey] = preIndex - 1;
                }
                else
                {
                    newStartPos.Add(xKey, -1);
                }

                PosUtil.SetFightCellPos(item.transform, xKey, newStartPos[xKey]);
            }

            for (int j = 0; j < cellMoveInfo.paths.Count; j++)
            {
                Vector2 pathPoint = cellMoveInfo.paths[j];
                Vector2 toPos     = PosUtil.GetFightCellPos((int)pathPoint.x, (int)pathPoint.y);
                float   speed     = isDeductStep ? 1750 : 1350;
                orderAction.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), speed));
            }
            FightEffectItem effectItem = effectLayer.GetEffectItemByPos(cellMoveInfo.cellInfo.posX, cellMoveInfo.cellInfo.posY);
            orderAction.AddNode(new PlayCellMoveEndActor(item, effectItem, cellMoveInfo.cellInfo));
        }
        if (waitmillisecond > 0)
        {
            rootAction.AddNode(new WaitActor(waitmillisecond));
        }
        rootAction.AddNode(paralle);
        ExecuteAction(fightState);
    }
Пример #5
0
    public GameObject ShowLine(CellInfo cellA, CellInfo cellB)
    {
        list.ForceChangeItemPrefab(lineItem);
        GameObject item = list.NewItem();

        item.name = cellA.posX + "_" + cellA.posY + "_" + cellB.posX + "_" + cellB.posY;

        PosUtil.SetFightCellPos(item.transform, cellB.posX, cellB.posY);

        item.transform.Rotate(0, 0, PosUtil.VectorAngle(PosUtil.GetFightCellPos(cellB.posX, cellB.posY), PosUtil.GetFightCellPos(cellA.posX, cellA.posY)));

        return(item);
    }
Пример #6
0
    public override void OnExecute()
    {
        base.OnExecute();
        GameObject item = layer.ShowLine(fcell, tcell);

        Image image = item.GetComponentInChildren <Image>();

        float len = VectorLen(PosUtil.GetFightCellPos(fcell.posX, fcell.posY), PosUtil.GetFightCellPos(tcell.posX, tcell.posY));

        image.rectTransform.sizeDelta  = new Vector2(len, 20);
        image.rectTransform.localScale = new Vector3(0, 1, 1);
        if (forceId > 0)
        {
            image.color = ColorUtil.GetColor(ColorUtil.GetCellColorValue(forceId));
        }
        else
        {
            image.color = ColorUtil.GetColor(ColorUtil.GetCellColorValue(fcell.config.id));
        }

        LeanTween.scaleX(image.gameObject, 1, len / 1500.00f).onComplete = CompleteHander;
    }
Пример #7
0
    private void Invade()
    {
        rootAction = new OrderAction();

        if (!isDeductStep)
        {
            ParallelAction      paralle     = new ParallelAction();
            List <CellAnimInfo> invadeCells = InvadeModel.Instance.EffectInvade();
            for (int i = 0; i < invadeCells.Count; i++)
            {
                ParallelAction paralleMove = new ParallelAction();

                CellInfo fromCell = invadeCells[i].fromInfo;
                CellInfo toCell   = invadeCells[i].toInfo;
                //Vector2 fromPos = PosUtil.GetFightCellPos(fromCell.posX, fromCell.posY);
                Vector2       toPos = PosUtil.GetFightCellPos(toCell.posX, toCell.posY);
                FightCellItem item  = GetItemByRunId(toCell.runId);
                PosUtil.SetFightCellPos(item.transform, fromCell.posX, fromCell.posY);
                item.icon = toCell.config.icon;
                item.transform.localScale = new Vector3(0.5f, 0.5f, 1);

                OrderAction order1 = new OrderAction();
                order1.AddNode(new PlaySoundActor("Refresh"));
                order1.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.2f));
                paralleMove.AddNode(order1);

                OrderAction order2 = new OrderAction();
                order2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.15f));
                paralleMove.AddNode(order2);

                paralle.AddNode(paralleMove);
            }

            rootAction.AddNode(paralle);
        }

        ExecuteAction(FightStadus.invade);
    }
Пример #8
0
    private void Refresh(int waitmillisecond = 0, List <CellInfo> cells = null, FightStadus fightStadus = FightStadus.prop_refresh)
    {
        bool hasRefresh = false;

        rootAction = new OrderAction();
        ParallelAction scale1 = new ParallelAction();
        ParallelAction movos  = new ParallelAction();
        ParallelAction scale2 = new ParallelAction();

        if (cells == null)
        {
            for (int 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];
                    CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX);
                    if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five && coverInfo.IsNull())
                    {
                        hasRefresh = true;

                        FightCellItem item = GetItemByRunId(cellInfo.runId);

                        if (fightStadus == FightStadus.changer)
                        {
                            item.transform.localRotation = Quaternion.identity;
                            scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f));
                        }
                        else
                        {
                            scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f));
                        }

                        if (fightStadus == FightStadus.changer)
                        {
                            scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f));
                        }
                        else
                        {
                            Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY);
                            movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f));

                            scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f));
                        }
                    }
                }
            }
        }
        else
        {
            for (int j = 0; j < cells.Count; j++)
            {
                CellInfo cellInfo = cells[j];
                if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five)
                {
                    hasRefresh = true;

                    FightCellItem item = GetItemByRunId(cellInfo.runId);

                    if (fightStadus == FightStadus.changer)
                    {
                        item.transform.localRotation = Quaternion.identity;
                        scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f));
                    }
                    else
                    {
                        scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f));
                    }


                    if (fightStadus == FightStadus.changer)
                    {
                        scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f));
                    }
                    else
                    {
                        Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY);
                        movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f));

                        scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f));
                    }
                }
            }
        }

        if (waitmillisecond > 0)
        {
            rootAction.AddNode(new WaitActor(waitmillisecond));
        }

        if (hasRefresh)
        {
            rootAction.AddNode(new PlaySoundActor("Refresh"));
        }

        rootAction.AddNode(scale1);
        rootAction.AddNode(movos);
        rootAction.AddNode(scale2);

        ExecuteAction(fightStadus);
    }
Пример #9
0
    private void Crawl()
    {
        rootAction = new OrderAction();
        if (!isDeductStep)
        {
            MonsterModel.Instance.Crawl();

            List <MonsterCrawlInfo> crawAnims = MonsterModel.Instance.crawAnims;

            rootAction = new OrderAction();
            ParallelAction paralle = new ParallelAction();

            for (int i = 0; i < crawAnims.Count; i++)
            {
                MonsterCrawlInfo crawAnim = crawAnims[i];

                OrderAction orderAction = new OrderAction();
                paralle.AddNode(orderAction);

                FightMonsterItem monsterItem = monsterLayer.GetItemByRunId(crawAnim.monster.runId);

                for (int j = 0; j < crawAnim.pathCells.Count; j++)
                {
                    CellInfo pathCell = crawAnim.pathCells[j];
                    Vector2  toPos    = PosUtil.GetFightCellPos(pathCell.posX, pathCell.posY);

                    float zrotate = 0;
                    if (j > 0)
                    {
                        Vector2 fromPos = PosUtil.GetFightCellPos(crawAnim.pathCells[j - 1].posX, crawAnim.pathCells[j - 1].posY);
                        zrotate = PosUtil.VectorAngle(new Vector2(fromPos.x, fromPos.y), new Vector2(toPos.x, toPos.y));
                    }
                    else
                    {
                        Vector2 anchoredPos = ((RectTransform)monsterItem.transform).anchoredPosition;
                        zrotate = PosUtil.VectorAngle(new Vector2(anchoredPos.x, anchoredPos.y), new Vector2(toPos.x, toPos.y));
                    }

                    orderAction.AddNode(new RotationActor((RectTransform)monsterItem.transform, zrotate));

                    float speed = 600;
                    orderAction.AddNode(new MoveActor((RectTransform)monsterItem.transform, new Vector3(toPos.x, toPos.y, 0), speed));

                    if (pathCell.isBlank == false)
                    {
                        FightCellItem cellItem = GetItemByRunId(pathCell.runId);
                        pathCell.SetConfig((int)crawAnim.monster.releaseList[0].id);
                        pathCell.changer = 0;
                        orderAction.AddNode(new ChangeCellActor(cellItem, pathCell));
                    }
                }

                if (crawAnim.roadEnd)
                {
                    orderAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.3f));
                    orderAction.AddNode(new ChangeMonsterActor(monsterItem, crawAnim.monster));
                }
            }

            rootAction.AddNode(paralle);
        }

        ExecuteAction(FightStadus.crawl);
    }
Пример #10
0
    private void PlayPutAutoSkill()
    {
        rootAction = new OrderAction();

        WaitActor waitActor = new WaitActor(200);

        rootAction.AddNode(waitActor);

        List <SkillEntityInfo> skillEntitys = SkillModel.Instance.GetNewSkillEntitys();

        fightUI.ShowSkill();


        if (lastTouchCell != null && skillEntitys.Count > 0)
        {
            ParallelAction parallelAction = new ParallelAction();
            int            holdIndex      = 0;
            bool           lastIsHump     = lastTouchCell.IsHump();
            for (int i = 0; i < skillEntitys.Count; i++)
            {
                OrderAction skillOrder = new OrderAction();

                SkillEntityInfo skillEntity = skillEntitys[i];

                Vector2 addPos = new Vector2();

                for (int h = holdIndex; h < 19; h++)
                {
                    Vector2 holePos = FightConst.GetHoleByLevel(h, lastIsHump);

                    Vector2 checkPos = new Vector2(lastTouchCell.posX + holePos.x, lastTouchCell.posY - holePos.y);

                    CellInfo checkCell = CellModel.Instance.GetCellByPos((int)checkPos.x, (int)checkPos.y);

                    if (checkCell != null && checkCell.isBlank)
                    {
                        addPos    = checkPos;
                        holdIndex = h + 1;
                        break;
                    }
                }

                CellInfo addItem = CellModel.Instance.AddItem(skillEntity.seed.config_cell_item.id, (int)addPos.x, (int)addPos.y);

                SkillModel.Instance.ThrowSkillEntity(skillEntity, addItem);

                GameObject itemObj = CreateCellItem(addItem);
                itemObj.transform.SetParent(effectLayer.transform, false);
                Vector2 toPos = PosUtil.GetFightCellPos(addItem.posX, addItem.posY);
                PosUtil.SetCellPos(itemObj.transform, skillEntity.seed.seed_x, skillEntity.seed.seed_y, 1.0f);

                rootAction.AddNode(new PlaySoundActor("Useskill"));

                rootAction.AddNode(new ShowEffectActor(itemObj.transform, "effect_skill_fly"));

                rootAction.AddNode(new MoveActor((RectTransform)itemObj.transform, new Vector3(toPos.x, toPos.y, 0), 1200));

                skillOrder.AddNode(new SetLayerActor(itemObj.transform, transform));
                skillOrder.AddNode(new PlaySoundActor("PutAutoSkill"));
                skillOrder.AddNode(new ClearEffectActor(itemObj.transform, "effect_skill_fly"));
                skillOrder.AddNode(new ScaleActor((RectTransform)itemObj.transform, new Vector3(1.2f, 1.2f, 0), 0.2f));
                skillOrder.AddNode(new ScaleActor((RectTransform)itemObj.transform, new Vector3(1, 1, 0), 0.1f));

                parallelAction.AddNode(skillOrder);
            }
            rootAction.AddNode(parallelAction);
        }

        waitActor = new WaitActor(200);
        rootAction.AddNode(waitActor);
        ExecuteAction(FightStadus.auto_skill);
    }