Exemplo n.º 1
0
        private void InitPlayerDecks()
        {
            int p1Id = PhotonNetwork.isMasterClient ? 1 : 0;
            int p2Id = p1Id == 0 ? 1 : 0;

            var p1LessonsBytes = PhotonNetwork.playerList[p1Id].customProperties["lessons"] as byte[];
            var p2LessonsBytes = PhotonNetwork.playerList[p2Id].customProperties["lessons"] as byte[];

            if (p1LessonsBytes == null || p2LessonsBytes == null)
            {
                Log.Error("p1 or p2 selected lessons are null, report this error!");
                return;
            }

            var p1SelectedLessons = p1LessonsBytes.Select(n => (LessonTypes)n).ToList();
            var p2SelectedLessons = p2LessonsBytes.Select(n => (LessonTypes)n).ToList();

            GameManager.NetworkIdCounter = 0;
            GameManager.AllCards.Clear();

            DeckGenerator.ResetStartingCharacterPool();

            Log.Write("Generating Player Decks");
            this.Player1.InitDeck(p1SelectedLessons);
            this.Player2.InitDeck(p2SelectedLessons);
        }