Esempio n. 1
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 = PosMgr.GetFightCellPos(posX, posY);
            Vector2 toPos   = PosMgr.GetFightCellPos(findCellPoint.posX, findCellPoint.posY);

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

            break;
        }
    }
Esempio n. 2
0
    public void Flow(ActionTree actionTree)
    {
        CoverModel.Instance.Flow();

        List <CoverAnimInfo> anims = CoverModel.Instance.anims[0];

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

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

                Vector2 toPos = PosMgr.GetFightCellPos(animInfo.coverInfo.posX, animInfo.coverInfo.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);
            }
        }
    }
Esempio n. 3
0
    public void ShowLine(CellInfo cellA, CellInfo cellB)
    {
        GameObject item = list.NewItem();

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

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

        item.transform.Rotate(0, 0, PosMgr.VectorAngle(PosMgr.GetFightCellPos(cellA.posX, cellA.posY), PosMgr.GetFightCellPos(cellB.posX, cellB.posY)));
    }
Esempio n. 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);
                }

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

            for (int j = 0; j < cellMoveInfo.paths.Count; j++)
            {
                Vector2 pathPoint = cellMoveInfo.paths[j];
                Vector2 toPos     = PosMgr.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);
    }
Esempio n. 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;

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

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

        return(item);
    }
Esempio n. 6
0
    public override void OnExecute()
    {
        base.OnExecute();
        GameObject item = layer.ShowLine(fcell, tcell);

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

        float len = VectorLen(PosMgr.GetFightCellPos(fcell.posX, fcell.posY), PosMgr.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 = ColorMgr.GetColor(ColorMgr.GetCellColorValue(forceId));
        }
        else
        {
            image.color = ColorMgr.GetColor(ColorMgr.GetCellColorValue(fcell.config.id));
        }

        LeanTween.scaleX(image.gameObject, 1, len / 1500.00f).onComplete = CompleteHander;
    }
Esempio n. 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 = PosMgr.GetFightCellPos(fromCell.posX, fromCell.posY);
                Vector2       toPos = PosMgr.GetFightCellPos(toCell.posX, toCell.posY);
                FightCellItem item  = GetItemByRunId(toCell.runId);
                PosMgr.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);
    }
Esempio n. 8
0
    private void Filling(List <CellMoveInfo> moveAnims, FightStadus fightState = FightStadus.move, int waitmillisecond = 0)
    {
        rootAction = new OrderAction();
        ParallelAction paralle = new ParallelAction();

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

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

            GameObject item = ballLayer.CreateBaseItem((int)cellMoveInfo.paths[0].x, -1);

            for (int j = 0; j < cellMoveInfo.paths.Count; j++)
            {
                ParallelAction paralleMove = new ParallelAction();
                orderAction.AddNode(paralleMove);

                Vector2 pathPoint = cellMoveInfo.paths[j];
                Vector2 toPos     = PosMgr.GetFightCellPos((int)pathPoint.x, (int)pathPoint.y);
                paralleMove.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.2f));

                if (j > 0)
                {
                    Vector2     fromPoint   = cellMoveInfo.paths[j - 1];
                    Vector2     fromPos     = PosMgr.GetFightCellPos((int)fromPoint.x, (int)fromPoint.y);
                    OrderAction orderRot    = new OrderAction();
                    GameObject  itembarrier = barrierLayer.GetItemByPos((int)fromPoint.x, (int)fromPoint.y);

                    if (itembarrier != null)
                    {
                        if (fromPos.x > toPos.x)
                        {
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, -60), 0.15f));
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, 0), 0.05f));
                            paralleMove.AddNode(orderRot);
                            paralleMove.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, -30), 0.2f));
                        }
                        if (fromPos.x < toPos.x)
                        {
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, 60), 0.15f));
                            orderRot.AddNode(new RoatateActor((RectTransform)itembarrier.transform, new Vector3(0, 0, 0), 0.05f));
                            paralleMove.AddNode(orderRot);
                            paralleMove.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 30), 0.2f));
                        }
                    }
                    List <TIVInfo> p  = new List <TIVInfo>();
                    TIVInfo        px = new TIVInfo();
                    px.value = pathPoint.x;
                    TIVInfo py = new TIVInfo();
                    py.value = pathPoint.y;
                    p.Add(px);
                    p.Add(py);
                    if (fromPos.x > toPos.x)
                    {
                        paralleMove.AddNode(new FuncTIVActor(Harvest, p));
                    }
                    if (fromPos.x < toPos.x)
                    {
                        paralleMove.AddNode(new FuncTIVActor(Harvest, p));
                    }
                }
            }
            BallBaseItem itemCtr = item.GetComponent <BallBaseItem>();
            orderAction.AddNode(new PlayBallMoveEndActor(itemCtr));
        }
        if (waitmillisecond > 0)
        {
            rootAction.AddNode(new WaitActor(waitmillisecond));
        }
        rootAction.AddNode(paralle);
        ExecuteAction(fightState);
    }
Esempio n. 9
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 = PosMgr.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 = PosMgr.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);
    }
Esempio n. 10
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    = PosMgr.GetFightCellPos(pathCell.posX, pathCell.posY);

                    float zrotate = 0;
                    if (j > 0)
                    {
                        Vector2 fromPos = PosMgr.GetFightCellPos(crawAnim.pathCells[j - 1].posX, crawAnim.pathCells[j - 1].posY);
                        zrotate = PosMgr.VectorAngle(new Vector2(fromPos.x, fromPos.y), new Vector2(toPos.x, toPos.y));
                    }
                    else
                    {
                        Vector2 anchoredPos = ((RectTransform)monsterItem.transform).anchoredPosition;
                        zrotate = PosMgr.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);
    }
Esempio n. 11
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 = PosMgr.GetFightCellPos(addItem.posX, addItem.posY);
                PosMgr.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);
    }