コード例 #1
0
ファイル: CardController.cs プロジェクト: mdlandis/unity-hs
    void Start()
    {
        players[0] = player1;
        players[1] = player2;

        //initialize the two players

        int indx;

        foreach (Player player in players)
        {
            player.processDecklist(getCorrectPath("player" + player.playernum + "decklist.txt"));


            player.deckPosX            = 12.0f;
            player.deckPosY            = 7.0f * (player.playernum * 2 - 3);
            indx                       = 0;
            player.startHandWidth      = -19.0F;
            player.handWidthDifference = 3.0f;
            player.handHeight          = 7.0f * (player.playernum * 2 - 3);

            player.startBoardPos        = -1.5f;
            player.boardWidthDifference = 3.0f;
            player.boardHeight          = 2.5f * (player.playernum * 2 - 3);

            foreach (Card card in player.decklist)
            {
                if (card == null)
                {
                    break;
                }
                HandCard newCard = Instantiate(baseCard) as HandCard;
                newCard.Player = player;
                newCard.SetCard(card);
                newCard.transform.position = new Vector3(player.deckPosX, player.deckPosY, -3);
                newCard.cardBack.enabled   = true;
                indx++;
                player.deck.Add(newCard);
            }

            Shuffle <HandCard>(player.deck);
            player.mulligan.getCards();


            player.hero.transform.position = new Vector3(12, 2.5f * (player.playernum * 2 - 3) - .2f, 0);
            player.hero.posToMoveTo        = player.hero.transform.position;
        }


        activePlayer         = player1;
        player1.activeplayer = true;
        player2.activeplayer = false;


        player1.startTurn();
    }
コード例 #2
0
ファイル: CardController.cs プロジェクト: mdlandis/unity-hs
    public HandCard createHandCard(Card card, Player p)
    {
        HandCard newCard = Instantiate(baseCard) as HandCard;

        newCard.Player = p;
        newCard.SetCard(card);
        newCard.cardBack.enabled = true;

        return(newCard);
    }