示例#1
0
    void ShuffleCards(CombatantBehavior combatant, Transform combatantTransform)
    {
        bool keepGoing = true;

        while (keepGoing)
        {
            if (combatant.GetNextOpenSlot() < handAmount && combatant.GetNextOpenSlot() != -1)
            {
                int openSlot = combatant.GetNextOpenSlot();
                //Probably not good to try/catch this.
                try
                {
                    CardBehavior card = cardScripts[combatant.GetCardInSlot(openSlot + 1)];
                    card.MoveSlot(openSlot, combatantTransform.GetChild(openSlot));
                    combatant.SetOccupiedSlot(openSlot + 1, false, -1);
                    combatant.SetOccupiedSlot(card.GetSlot(), true, card.GetSessionId());
                }
                catch
                {
                    keepGoing = false;
                }
            }
            else
            {
                keepGoing = false;
            }
        }
    }
示例#2
0
    void DrawCard(CombatantBehavior combatant)
    {
        //In cardbehavior
        int slot = combatant.GetNextOpenSlot();

        if (slot != -1)
        {
            combatant.SetOccupiedSlot(slot, true, SpawnCardRandomDeck(combatant.transform.GetChild(slot), slot, combatant.GetSessionId(), combatant.GetDeckLength()));
            //combatant.SetOccupiedSlot(slot, true, SpawnCardRandomDeck(combatant.transform.GetChild(slot), slot, combatant.GetId(), combatant.GetDeckLength()));
            //combatant.SetOccupiedSlot(slot, true, SpawnCardFullDeck(combatant.transform.GetChild(slot), slot, combatant.GetId()));
        }
    }