Beispiel #1
0
    private void StartBus()
    {
        // clear the Guitar
        foreach (var gObj in CardsOnTable)
        {
            Destroy(gObj);
        }
        CardsOnTable = new List <GameObject>();
        Deck         = StaticHelperFunctions.ResetCards();
        // create the bus pattern
        var busSize    = 5;
        var startSize  = busSize / 2;
        var busHeights = new int[] { 1, 2, 3, 2, 1 };

        for (int i = 0; i < busSize; i++)
        {
            for (int j = 0; j < busHeights[i]; j++)
            {
                var busCard     = DrawCard(Deck);
                var startYcoord = 0.0f;
                switch (busHeights[i])
                {
                case 1:
                    startYcoord = 0.0f;
                    break;

                case 2:
                    startYcoord = -4.0f;
                    break;

                case 3:
                    startYcoord = -8.0f;
                    break;

                default:
                    break;
                }
                PlaceCard(startSize * -5 + i * 5, startYcoord + j * 8, busCard, 0, CardType.BusRide);
            }
        }

        if (PlayersOnBus.Count < 2)
        {
            // enable player selector
            BusPassengerPanel.SetActive(true);
            var busDropdown      = BusPassengerPanel.GetComponentInChildren <Dropdown>();
            var availablePlayers = Players.Where(p => p.Name != PlayersOnBus.First().Name).Select(p => p.Name).ToList();
            busDropdown.ClearOptions();
            busDropdown.AddOptions(availablePlayers);
        }
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        CardsOnTable      = new List <GameObject>();
        GiveActionPlayers = new List <PlayerCardPair>();
        CardsActiveOnBus  = new List <CardObject>();
        PlayersOnBus      = new List <Player>();
        // TODO move to another place for init
        // Player init
        Players = new List <Player>();

        CurrentPlayerIndex = 0;

        // initialize deck of cards
        Deck = StaticHelperFunctions.ResetCards();
    }