private void Harvest(List <TIVInfo> p) { int px = (int)p[0].value; int py = (int)p[1].value; GameObject itemGift = giftLayer.GetItemByPos(px, py); if (itemGift != null) { OrderAction giftOrder = new OrderAction(); giftOrder.AddNode(new WaitActor(40)); giftOrder.AddNode(new SoundActor("Harvest")); giftOrder.AddNode(new ScaleActor((RectTransform)itemGift.transform, new Vector3(1.2f, 1.2f, 0), 0.1f)); giftOrder.AddNode(new ScaleActor((RectTransform)itemGift.transform, new Vector3(0, 0, 0), 0.04f)); giftOrder.AddNode(new DestroyActor(itemGift)); if (py == -BattleModel.Instance.crtBattle.end_y + BattleModel.Instance.crtBattle.start_y) { int bottleId = UnityEngine.Random.Range(10101, 10101 + 5); giftOrder.AddNode(new HarvestActor(px, py, bottleId, 50, effectLayer)); } else { giftOrder.AddNode(new HarvestActor(px, py, 11102, 10, effectLayer)); } giftOrder.OnExecute(); } }
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); }