public void AddCrawAnim(MonsterInfo monster, CellInfo cellInfo) { int i; for (i = 0; i < crawAnims.Count; i++) { MonsterCrawlInfo monsterCrawlInfo = crawAnims[i]; if (monsterCrawlInfo.monster.runId == monster.runId) { monsterCrawlInfo.AddPath(cellInfo); return; } } MonsterCrawlInfo addCrawlInfo = new MonsterCrawlInfo(); addCrawlInfo.monster = monster; addCrawlInfo.AddPath(cellInfo); crawAnims.Add(addCrawlInfo); }
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); }