示例#1
0
    private void DrawAvailableProjectCards(List <ProjectCard> cards)
    {
        int howManyI   = cards.FindAll((obj) => obj.TakeProjectDice == CardDice.I).Count;
        int howManyII  = cards.FindAll((obj) => obj.TakeProjectDice == CardDice.II).Count;
        int howManyIII = cards.FindAll((obj) => obj.TakeProjectDice == CardDice.III).Count;
        int howManyIV  = cards.FindAll((obj) => obj.TakeProjectDice == CardDice.IV).Count;
        int howManyV   = cards.FindAll((obj) => obj.TakeProjectDice == CardDice.V).Count;
        int howManyVI  = cards.FindAll((obj) => obj.TakeProjectDice == CardDice.VI).Count;

        int countI   = 0;
        int countII  = 0;
        int countIII = 0;
        int countIV  = 0;
        int countV   = 0;
        int countVI  = 0;

        foreach (ProjectCard pc in cards)
        {
            Vector2 position;
            switch (pc.TakeProjectDice)
            {
            case CardDice.I:
                position = D.PositionForActionCard(D.PositionProjectDiceI, countI, howManyI);
                gameObjects.Add(CardsGenerator.DrawTakeProjectCard(pc.Card, position));
                countI++;
                break;

            case CardDice.II:
                position = D.PositionForActionCard(D.PositionProjectDiceII, countII, howManyII);
                gameObjects.Add(CardsGenerator.DrawTakeProjectCard(pc.Card, position));
                countII++;
                break;

            case CardDice.III:
                position = D.PositionForActionCard(D.PositionProjectDiceIII, countIII, howManyIII);
                gameObjects.Add(CardsGenerator.DrawTakeProjectCard(pc.Card, position));
                countIII++;
                break;

            case CardDice.IV:
                position = D.PositionForActionCard(D.PositionProjectDiceIV, countIV, howManyIV);
                gameObjects.Add(CardsGenerator.DrawTakeProjectCard(pc.Card, position));
                countIV++;
                break;

            case CardDice.V:
                position = D.PositionForActionCard(D.PositionProjectDiceV, countV, howManyV);
                gameObjects.Add(CardsGenerator.DrawTakeProjectCard(pc.Card, position));
                countV++;
                break;

            case CardDice.VI:
                position = D.PositionForActionCard(D.PositionProjectDiceVI, countVI, howManyVI);
                gameObjects.Add(CardsGenerator.DrawTakeProjectCard(pc.Card, position));
                countVI++;
                break;

            default:
                throw new System.InvalidProgramException("Project card with invalid Dice: " + pc.TakeProjectDice);
            }
        }
    }