Ejemplo n.º 1
0
    public void PlayEliminate(List <MonsterAnimInfo> monsterAnimss, ActionTree actionTree)
    {
        for (int j = 0; j < monsterAnimss.Count; j++)
        {
            OrderAction     order           = new OrderAction();
            MonsterAnimInfo monsterAnimInfo = monsterAnimss[j];

            FightMonsterItem item = GetItemByRunId(monsterAnimInfo.monsterInfo.runId);

            switch (monsterAnimInfo.animationType)
            {
            case CellAnimType.clear:
                order.AddNode(new ShowEffectActor(item.transform, "effect_cell_bomb", fightModule.transform));
                order.AddNode(new PlaySoundActor("remove"));
                order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f));
                order.AddNode(new DestroyActor(item.gameObject));
                break;

            case CellAnimType.wreck:
                order.AddNode(new ShowEffectActor(item.transform, "effect_cell_bomb", fightModule.transform));
                order.AddNode(new PlaySoundActor("remove"));
                order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f));
                //if (monsterAnimInfo.monsterInfo.IsNull())
                //{
                //    order.AddNode(new DestroyActor(item.gameObject));
                //}else
                //{
                order.AddNode(new ChangeMonsterActor(item, monsterAnimInfo.monsterInfo));
                //}
                break;
            }
            actionTree.AddNode(order);
        }
    }
Ejemplo n.º 2
0
    public void UpdateMonsterItem(FightMonsterItem itemCtr, MonsterInfo monsterInfo)
    {
        itemCtr.type        = type;
        itemCtr.monsterInfo = monsterInfo;
        itemCtr.icon        = monsterInfo.config.icon;

        if (monsterInfo.rotate != 0)
        {
            itemCtr.zrotate = monsterInfo.rotate * FightConst.ROTATE_BASE;
        }
        else
        {
            itemCtr.zrotate = monsterInfo.config.rotate * FightConst.ROTATE_BASE;
        }
        itemCtr.ShowProgress(monsterInfo.progress);
        itemCtr.ShowBan(monsterInfo.banCount > 1);
    }
Ejemplo n.º 3
0
    public GameObject CreateMonsterItem(int posX, int posY, MonsterInfo monsterInfo)
    {
        if (monsterInfo.IsNull())
        {
            return(null);
        }
        FightMonsterItem itemCtr = GetItemByRunId(monsterInfo.runId);

        if (itemCtr == null)
        {
            GameObject item = list.NewItem();
            item.name = posX + "_" + posY;
            itemCtr   = item.AddComponent <FightMonsterItem>();
            PosMgr.SetFightCellPos(item.transform, posX, posY);
        }
        UpdateMonsterItem(itemCtr, monsterInfo);
        return(itemCtr.gameObject);
    }
Ejemplo n.º 4
0
    public void UpdateList()
    {
        List <GameObject> items = list.items;

        for (int i = 0; i < items.Count; i++)
        {
            GameObject item = (GameObject)items[i];
            if (item == null)
            {
                continue;
            }
            FightMonsterItem itemCtr = item.GetComponent <FightMonsterItem>();

            if (!itemCtr.monsterInfo.IsNull())
            {
                UpdateMonsterItem(itemCtr, itemCtr.monsterInfo);
            }
        }
    }
Ejemplo n.º 5
0
    public FightMonsterItem GetItemByRunId(int runId)
    {
        List <GameObject> items = list.items;

        for (int i = 0; i < items.Count; i++)
        {
            GameObject item = (GameObject)items[i];
            if (item == null)
            {
                continue;
            }
            FightMonsterItem cellItemCtr = item.GetComponent <FightMonsterItem>();

            if (cellItemCtr.monsterInfo.runId == runId)
            {
                return(cellItemCtr);
            }
        }
        return(null);
    }
Ejemplo n.º 6
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);
    }
Ejemplo n.º 7
0
    private void UnlockMonster(bool isJet = false)
    {
        List <int> unLockIds = MonsterModel.Instance.UnLock(isJet);

        MonsterModel.Instance.BackUpUnLockMonster(unLockIds);
        rootAction = new OrderAction();
        for (int j = 0; j < unLockIds.Count; j++)
        {
            int monsterRunId             = unLockIds[j];
            FightMonsterItem monsterItem = monsterLayer.GetItemByRunId(monsterRunId);
            rootAction.AddNode(new SetLayerActor(monsterItem.transform, effectLayer.transform));

            CellInfo monsterCell = new CellInfo();
            monsterCell.posX = monsterItem.monsterInfo.posX;
            monsterCell.posY = monsterItem.monsterInfo.posY;
            if (isJet)
            {
                if (monsterItem.monsterInfo.IsNull())
                {
                    CellDirType dirType = WallModel.Instance.GetGapWallDir(monsterCell);
                    int         zrotate = PosUtil.GetRotateByDir(dirType);
                    rootAction.AddNode(new RoatateActor((RectTransform)monsterItem.transform, new Vector3(0, 0, zrotate), 0.25f));
                }
                else
                {
                    rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1.15f, 1.15f, 1f), 0.2f));
                }
            }

            List <CellInfo> releaseList = MonsterModel.Instance.ReleaseList(monsterRunId);
            if (releaseList.Count > 0)
            {
                ParallelAction paralle = new ParallelAction();
                for (int i = 0; i < releaseList.Count; i++)
                {
                    CellInfo      cellInfo = releaseList[i];
                    FightCellItem item     = GetItemByRunId(cellInfo.runId);
                    if (item == null)
                    {
                        GameObject itemObj = CreateCellItem(cellInfo);
                        item = itemObj.GetComponent <FightCellItem>();
                    }
                    OrderAction order = new OrderAction();
                    order.AddNode(new PlaySoundActor("Refresh"));

                    order.AddNode(new ShowEffectLineActor(effectLayer, cellInfo, monsterCell, monsterItem.monsterInfo.releaseId));

                    order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f));

                    order.AddNode(new ChangeCellActor(item, cellInfo, monsterItem.monsterInfo.releaseId));

                    paralle.AddNode(order);
                }
                rootAction.AddNode(paralle);
            }
            if (monsterItem.monsterInfo.IsNull())
            {
                rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1.25f, 1.25f, 0), 0.15f));
                if (j == 0)
                {
                    rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.25f));
                }
                else
                {
                    rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.15f));
                }
            }
            else
            {
                rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1, 1, 1), 0.05f));

                CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(monsterItem.monsterInfo.posY, monsterItem.monsterInfo.posX);

                FightCoverItem coverItem = coverLayer.GetItemByRunId(coverInfo.runId);

                rootAction.AddNode(new ChangeCoverActor(coverLayer, coverItem, coverInfo));
                rootAction.AddNode(new ProgressMonsterActor(monsterItem, monsterItem.monsterInfo.progress));
                rootAction.AddNode(new SetLayerActor(monsterItem.transform, monsterLayer.transform));
            }
        }
        if (isJet)
        {
            ExecuteAction(FightStadus.jet_monster);
        }
        else
        {
            ParallelAction paralleTimer = new ParallelAction();

            List <CellInfo> timerCells = CellModel.Instance.Timing();
            for (int i = 0; i < timerCells.Count; i++)
            {
                CellInfo      cellInfo = timerCells[i];
                FightCellItem item     = GetItemByRunId(cellInfo.runId);
                if (item != null)
                {
                    OrderAction order = new OrderAction();
                    order.AddNode(new PlaySoundActor("Refresh"));
                    order.AddNode(new ChangeCellActor(item, cellInfo));
                    if (cellInfo.isBlank)
                    {
                        order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.2f));
                        order.AddNode(new DestroyActor(item.gameObject));
                    }
                    paralleTimer.AddNode(order);
                }
            }

            List <CoverInfo> timerCovers = CoverModel.Instance.Timing();
            for (int i = 0; i < timerCovers.Count; i++)
            {
                CoverInfo      coverInfo = timerCovers[i];
                FightCoverItem item      = coverLayer.GetItemByRunId(coverInfo.runId);

                OrderAction order = new OrderAction();
                order.AddNode(new PlaySoundActor("Refresh"));
                order.AddNode(new ChangeCoverActor(coverLayer, item, coverInfo));

                if (coverInfo.IsNull())
                {
                    order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.2f));
                    order.AddNode(new DestroyActor(item.gameObject));

                    List <CoverInfo> covers = CoverModel.Instance.GetNeighbors(coverInfo);
                    for (int n = 0; n < covers.Count; n++)
                    {
                        CoverInfo cover = covers[n];
                        if (cover != null)
                        {
                            item = coverLayer.GetItemByRunId(cover.runId);
                            order.AddNode(new ChangeCoverActor(coverLayer, item, cover));
                            if (cover.config != null)
                            {
                                coverFlowInterrupt = true;
                            }
                        }
                    }
                }
                paralleTimer.AddNode(order);
            }

            rootAction.AddNode(paralleTimer);

            if (coverFlowInterrupt)
            {
                rootAction.AddNode(new FuncActor(coverLayer.ShowList));                //todo 爆后流动导致多出蜘蛛网
            }

            ExecuteAction(FightStadus.unlock_monster);
        }
    }
Ejemplo n.º 8
0
 public ProgressMonsterActor(FightMonsterItem monsterItem, float progress)
     : base()
 {
     item           = monsterItem;
     progressAbsorb = progress;
 }
Ejemplo n.º 9
0
 private void CompleteHander()
 {
     item = null;
     OnEnd();
 }
Ejemplo n.º 10
0
 public ChangeMonsterActor(FightMonsterItem monsterItem, MonsterInfo monsterInfo)
     : base()
 {
     item = monsterItem;
     info = monsterInfo;
 }