Esempio n. 1
0
    public CardLostCities MoveToAIDiscard(CardLostCities tCB)
    {
        WhichAIDiscard(tCB).Add(tCB);

        if (tCB.suit.Equals("R"))
        {
            tCB.SetSortingLayerName(layout.redPlayer2.layerName);
            tCB.SetSortOrder(redPlayer2.Count * 4);
            tCB.transform.localPosition = layout.redPlayer2.pos + Vector3.back / 2;
            tCB.transform.localRotation = Quaternion.Euler(Vector3.zero);
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("G"))
        {
            tCB.SetSortingLayerName(layout.greenPlayer2.layerName);
            tCB.SetSortOrder(greenPlayer2.Count * 4);
            tCB.transform.localPosition = layout.greenPlayer2.pos + Vector3.back / 2;
            tCB.transform.localRotation = Quaternion.Euler(Vector3.zero);
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("W"))
        {
            tCB.SetSortingLayerName(layout.whitePlayer2.layerName);
            tCB.SetSortOrder(whitePlayer2.Count * 4);
            tCB.transform.localPosition = layout.whitePlayer2.pos + Vector3.back / 2;
            tCB.transform.localRotation = Quaternion.Euler(Vector3.zero);
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("B"))
        {
            tCB.SetSortingLayerName(layout.bluePlayer2.layerName);
            tCB.SetSortOrder(bluePlayer2.Count * 4);
            tCB.transform.localPosition = layout.bluePlayer2.pos + Vector3.back / 2;
            tCB.transform.localRotation = Quaternion.Euler(Vector3.zero);
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("Y"))
        {
            tCB.SetSortingLayerName(layout.yellowPlayer2.layerName);
            tCB.SetSortOrder(yellowPlayer2.Count * 4);
            tCB.transform.localPosition = layout.yellowPlayer2.pos + Vector3.back / 2;
            tCB.transform.localRotation = Quaternion.Euler(Vector3.zero);
            ArrangePlayer2Pile();
        }

        tCB.state = CBState.player2;

        players[1].RemoveCard(tCB);

        return(tCB);
    }
Esempio n. 2
0
    public List <CardLostCities> hand; // The cards in this player's hand

    // Add a card to the hand
    public CardLostCities AddCard(CardLostCities eCB)
    {
        if (hand == null)
        {
            hand = new List <CardLostCities>();
        }

        // Add the card to the hand
        hand.Add(eCB);

        //Sort the cards by rank using LINQ if this is a human
        if (type == PlayerType.human)
        {
            CardLostCities[] cards = hand.ToArray();

            // This is the LINQ call
            cards = cards.OrderBy(cd => cd.rank).ToArray();


            hand = new List <CardLostCities>(cards);
            // Note: LINQ operations can be a bit slow (like it could take a
            // couple of milliseconds), but since we're only doing it once
            // every round, it isn't a problem.
        }

        eCB.SetSortingLayerName("10"); // Sorts the moving card to the top
        eCB.eventualSortLayer = handSlotDef.layerName;

        FanHand();
        return(eCB);
    }
Esempio n. 3
0
    // This makes a new card the target
    public CardLostCities MoveToTarget(CardLostCities tCB)
    {
        tCB.timeStart = 0;


        tCB.state  = CBState.toTarget;
        tCB.faceUp = true;

        tCB.SetSortingLayerName("10");
        tCB.eventualSortLayer = layout.target.layerName;
        if (targetCard != null)
        {
            MoveToDiscard(targetCard);
        }

        targetCard = tCB;

        return(tCB);
    }
Esempio n. 4
0
    public CardLostCities MoveToAIDiscard(CardLostCities tCB)
    {
        WhichAIDiscard(tCB).Add(tCB);
        Vector3 pos;

        tCB.timeStart = 0;
        if (tCB.suit.Equals("R"))
        {
            tCB.SetSortingLayerName(layout.redPlayer2.layerName);
            tCB.SetSortOrder(redPlayer2.Count * 4);
            pos = layout.redPlayer2.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toRedPlayer2;
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("G"))
        {
            tCB.SetSortingLayerName(layout.greenPlayer2.layerName);
            tCB.SetSortOrder(greenPlayer2.Count * 4);
            pos = layout.greenPlayer2.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toGreenPlayer2;
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("W"))
        {
            tCB.SetSortingLayerName(layout.whitePlayer2.layerName);
            tCB.SetSortOrder(whitePlayer2.Count * 4);
            pos = layout.whitePlayer2.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toWhitePlayer2;
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("B"))
        {
            tCB.SetSortingLayerName(layout.bluePlayer2.layerName);
            tCB.SetSortOrder(bluePlayer2.Count * 4);
            pos = layout.bluePlayer2.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toBluePlayer2;;
            ArrangePlayer2Pile();
        }
        if (tCB.suit.Equals("Y"))
        {
            tCB.SetSortingLayerName(layout.yellowPlayer2.layerName);
            tCB.SetSortOrder(yellowPlayer2.Count * 4);
            pos = layout.yellowPlayer2.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toYellowPlayer2;
            ArrangePlayer2Pile();
        }



        players[1].RemoveCard(tCB);

        return(tCB);
    }
Esempio n. 5
0
    public CardLostCities MoveToPlayerDiscard(CardLostCities tCB)
    {
        WhichPlayerDiscard(tCB).Add(tCB);
        Vector3 pos;

        tCB.timeStart = 0;
        if (tCB.suit.Equals("R"))
        {
            tCB.SetSortingLayerName(layout.redPlayer1.layerName);
            tCB.SetSortOrder(redPlayer1.Count * 4);
            //tCB.transform.localPosition = layout.redPlayer1.pos + Vector3.back / 2;
            //tCB.transform.localRotation = Quaternion.Euler(Vector3.zero);

            pos = layout.redPlayer1.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toRedPlayer1;

            ArrangePlayerPile();
        }
        if (tCB.suit.Equals("G"))
        {
            tCB.SetSortingLayerName(layout.greenPlayer1.layerName);
            tCB.SetSortOrder(greenPlayer1.Count * 4);

            pos = layout.greenPlayer1.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toGreenPlayer1;

            ArrangePlayerPile();
        }
        if (tCB.suit.Equals("W"))
        {
            tCB.SetSortingLayerName(layout.whitePlayer1.layerName);
            tCB.SetSortOrder(whitePlayer1.Count * 4);
            pos = layout.whitePlayer1.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toWhitePlayer1;
            ArrangePlayerPile();
        }
        if (tCB.suit.Equals("B"))
        {
            tCB.SetSortingLayerName(layout.bluePlayer1.layerName);
            tCB.SetSortOrder(bluePlayer1.Count * 4);

            pos = layout.bluePlayer1.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toBluePlayer1;
            ArrangePlayerPile();
        }
        if (tCB.suit.Equals("Y"))
        {
            tCB.SetSortingLayerName(layout.yellowPlayer1.layerName);
            tCB.SetSortOrder(yellowPlayer1.Count * 4);

            pos = layout.yellowPlayer1.pos;
            tCB.MoveTo(pos);

            tCB.state = CBState.toYellowPlayer1;
            ArrangePlayerPile();
        }



        players[0].RemoveCard(tCB);

        return(tCB);
    }