Ejemplo n.º 1
0
    private void Awake()
    {
        sessionControllerInternal = new SessionControllerInternal(this);
        realDeck     = deck;
        moverAbility = GetComponent <MoverAbility>();
        if (moverAbility != null)
        {
            hasMoverAbility = true;
        }

        parent   = uicards.GetComponent <IPokerOwner>();
        defaultV = delayeBetweenMiddleCard.Value;
        //delayeBetweenMiddleCard.Variable.SetValue(1);
    }
Ejemplo n.º 2
0
        public IEnumerator Test_MoveAbility()
        {
            MoverAbilityInternal moverAbility = new MoverAbilityInternal();

            GameObject startLocationObject = new GameObject();

            startLocationObject.transform.position = new Vector2(0, 0);
            Locations startLocations = new Locations(startLocationObject.transform, startLocationObject.transform.position, false);

            GameObject endLocationObject = new GameObject();

            endLocationObject.transform.position = new Vector2(0, 20);
            Locations endLocations = new Locations(endLocationObject.transform, endLocationObject.transform.position, false);

            IPokerOwner parent = Substitute.For <IPokerOwner>();

            parent.speed = 2f;
            GameObject           card            = new GameObject("card");
            Card                 po              = card.AddComponent <Card>();
            ISpriteSwaperAbility swaperAbility   = Substitute.For <ISpriteSwaperAbility>();
            ICardFlipAbility     cardFlipAbility = Substitute.For <ICardFlipAbility>();

            moverAbility.Move(new List <IPokerObject>()
            {
                po as IPokerObject
            }, new List <Locations>()
            {
                startLocations
            }, new List <Locations>()
            {
                endLocations
            }, parent, true, true, swaperAbility, cardFlipAbility);
            yield return(new WaitForSeconds(parent.speed + 0.5f));

            Assert.AreEqual(endLocationObject.transform.position, po.transform.position);
        }
Ejemplo n.º 3
0
 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
             }
         }
     }
 }
Ejemplo n.º 4
0
 public void Move(List <IPokerObject> objectsToMove, List <Locations> startLocations, List <Locations> endLocations, IPokerOwner parent)
 {
     moverAbilityInternal.Move(objectsToMove, startLocations, endLocations, parent, hasSwapAbility, hasCardFlipAbility, swapAbility, cardFlipAbility);
 }