Ejemplo n.º 1
0
    public List <CardLoot> hand; // The cards in this player's hand

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

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

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

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

            hand = new List <CardLoot>(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.
        }

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

        FanHand();
        return(eCL);
    }
Ejemplo n.º 2
0
Archivo: Loot.cs Proyecto: etomsky/Loot
    public CardLoot MoveToDiscard(CardLoot tCL)
    {
        tCL.state = CLState.discard;
        discardPile.Add(tCL);
        tCL.SetSortingLayerName(layout.discardPile.layerName);
        tCL.SetSortOrder(discardPile.Count * 4);
        tCL.transform.localPosition = layout.discardPile.pos + Vector3.back / 2;

        return(tCL);
    }
Ejemplo n.º 3
0
Archivo: Loot.cs Proyecto: etomsky/Loot
    // This makes a new card the target
    public CardLoot MoveToTarget(CardLoot tCL)
    {
        tCL.timeStart = 0;
        tCL.MoveTo(layout.discardPile.pos + Vector3.back);
        tCL.state  = CLState.toTarget;
        tCL.faceUp = true;

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

        target = tCL;

        return(tCL);
    }