public void Move(List <IPokerObject> objectsToMove, List <Locations> startLocations, List <Locations> endLocations, IPokerOwner parent, bool hasSwapAbility, bool hasCardFlipAbility, ISpriteSwaperAbility swapAbility, ICardFlipAbility cardFlipAbility) { if (objectsToMove.Count <= endLocations.Count && objectsToMove.Count <= startLocations.Count) { for (int i = 0; i < objectsToMove.Count; i++) { if (!endLocations[i].isFilled) { var endObject = endLocations[i]; var ObjectToMove = objectsToMove[i].GetPokerObject; ObjectToMove.transform.localPosition = new Vector2(startLocations[i].location.x, startLocations[i].location.y); ObjectToMove.transform.DOLocalMove(endLocations[i].location, parent.speed).OnComplete(() => { endObject.isFilled = parent.fillUp; if (hasSwapAbility && !parent.dontSwap && parent.dontFlip) { swapAbility.SwapSprites(ObjectToMove, parent.isRealPlayer); } if (hasCardFlipAbility && parent.isRealPlayer && !parent.dontFlip) { cardFlipAbility.FlipCards(ObjectToMove); } //parent.action(); }).SetEase(Ease.Linear);//set ease type for movement } } } }
public void FlipCards(GameObject real, bool hasSwapAbility, ISpriteSwaperAbility swapAbility, float moveSpeed) { real.transform.DOScaleX(0, moveSpeed).OnComplete(() => { if (hasSwapAbility) { swapAbility.SwapSprites(real, true); } real.transform.DOScaleX(1, moveSpeed).OnComplete(() => { }); }); }