public virtual void Awake() { foreach (Photon.Realtime.Player p in PhotonNetwork.PlayerList) { if (p.IsLocal) { localPlayer = new MyPlayer(); localPlayer.PlayerId = p.ActorNumber.ToString(); localPlayer.PlayerName = p.NickName; localPlayer.Position = PlayerPositions[0].position; } else { remotePlayer = new MyPlayer(); remotePlayer.PlayerId = p.ActorNumber.ToString(); remotePlayer.PlayerName = p.NickName; remotePlayer.Position = PlayerPositions[1].position; } gameDataManager = new GameDataManager(localPlayer, remotePlayer); } //remotePlayer = new Player(); //remotePlayer.PlayerId = "offline-bot"; //remotePlayer.PlayerName = "Bot"; //remotePlayer.Position = PlayerPositions[1].position; //remotePlayer.BookPosition = BookPositions[1].position; //remotePlayer.IsAI = true; cardAnimator = FindObjectOfType <CardAnimator>(); }
protected virtual void OnGameStarted() { gameDataManager = new GameDataManager(localPlayer, remotePlayer); gameDataManager.Shuffle(); gameDataManager.DealCardValuesToPlayer(localPlayer, Constants.PLAYER_INITIAL_CARDS); gameDataManager.DealCardValuesToPlayer(remotePlayer, Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(localPlayer, Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(remotePlayer, Constants.PLAYER_INITIAL_CARDS); }
protected virtual void OnGameStarted() { gameDataManager = new GameDataManager(localPlayer, remotePlayer); gameDataManager.Shuffle(); //PLAY SOUND audioData.PlayOneShot(shuffleClip); //audioData.clip = shuffleClip; //audioData.loop = true; //audioData.Play(); for (int i = 0; i < 3; i++) { byte bookRankP1 = gameDataManager.DrawCardValue(); byte bookRankP2 = gameDataManager.DrawCardValue(); //cardAnimator.DealBooks(localPlayer, bookRankP1); //cardAnimator.DealBooks(remotePlayer, bookRankP2); remotePlayer.CreateBottomBook(bookRankP1, cardAnimator, i); localPlayer.CreateBottomBook(bookRankP2, cardAnimator, i); gameDataManager.AddBottomBooksForPlayer(localPlayer, Card.GetRank(bookRankP1)); gameDataManager.AddBottomBooksForPlayer(remotePlayer, Card.GetRank(bookRankP2)); } for (int i = 0; i < 3; i++) { byte bookRankP1 = gameDataManager.DrawCardValue(); byte bookRankP2 = gameDataManager.DrawCardValue(); remotePlayer.CreateTopBook(bookRankP1, cardAnimator, i); localPlayer.CreateTopBook(bookRankP2, cardAnimator, i); //localPlayer.ReceiveBook(bookRankP1, cardAnimator); gameDataManager.AddBooksForPlayer(localPlayer, Card.GetRank(bookRankP1)); gameDataManager.AddBooksForPlayer(remotePlayer, Card.GetRank(bookRankP2)); } for (int i = 0; i < 3; i++) { gameDataManager.DealCardValuesToPlayer(localPlayer, PLAYER_INITIAL_2_CARDS); gameDataManager.DealCardValuesToPlayer(remotePlayer, PLAYER_INITIAL_2_CARDS); cardAnimator.DealDisplayingCards(localPlayer, PLAYER_INITIAL_2_CARDS); cardAnimator.DealDisplayingCards(remotePlayer, PLAYER_INITIAL_2_CARDS); } //audioData.loop = false; //audioData.Stop(); gameState = GameState.TurnStarted; }
protected virtual void OnGameStarted() { gameDataManager = new GameDataManager(localPlayer, remotePlayer); //Stack.text = localPlayer.StackAmt.ToString(); gameDataManager.Shuffle(); gameDataManager.DealCardValuesToPlayer(localPlayer, Constants.PLAYER_INITIAL_CARDS); gameDataManager.DealCardValuesToPlayer(remotePlayer, Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(localPlayer, Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(remotePlayer, Constants.PLAYER_INITIAL_CARDS); gameState = GameState.TurnStarted; }
protected virtual void OnGameStarted() { gameDataManager = new GameDataManager(localPlayer, remotePlayer[0], remotePlayer[1], remotePlayer[2]); //mozda redundantno gameDataManager.Shuffle(); gameDataManager.DealCardValuesToPlayer(localPlayer, Constants.PLAYER_INITIAL_CARDS); gameDataManager.DealCardValuesToPlayer(remotePlayer[0], Constants.PLAYER_INITIAL_CARDS); gameDataManager.DealCardValuesToPlayer(remotePlayer[1], Constants.PLAYER_INITIAL_CARDS); gameDataManager.DealCardValuesToPlayer(remotePlayer[2], Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(localPlayer, Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(remotePlayer[0], Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(remotePlayer[1], Constants.PLAYER_INITIAL_CARDS); cardAnimator.DealDisplayingCards(remotePlayer[2], Constants.PLAYER_INITIAL_CARDS); gameState = GameState.TurnStarted; }
protected new void Awake() { base.Awake(); netCode = FindObjectOfType <NetCode>(); NetworkClient.Lobby.GetPlayersInRoom((sucessful, reply, error) => { if (sucessful) { int i = 0; if (reply.players != null) { foreach (SWPlayer player in reply.players) { string playerName = player.GetCustomDataString(); string playerId = player.id; if (playerId.Equals(NetworkClient.Instance.PlayerId)) { localPlayer.PlayerName = playerName; localPlayer.PlayerId = playerId; } else { remotePlayer[i].PlayerName = playerName; remotePlayer[i].PlayerId = playerId; i++; } } ChoseThePlayerCardButtonPanel.GetComponent <ButtonPlayerConfiguration>().AsignPlayersToButtons(remotePlayer[0].PlayerName, remotePlayer[1].PlayerName, remotePlayer[2].PlayerName); } else { //vjv javit error } gameDataManager = new GameDataManager(localPlayer, remotePlayer[0], remotePlayer[1], remotePlayer[2], NetworkClient.Lobby.RoomId); netCode.EnableRoomPropertyAgent(); } else { Debug.Log("Failed to get players in the room."); } }); }
protected new void Awake() { base.Awake(); remotePlayer.IsAI = false; netCode = FindObjectOfType <NetCode>(); NetworkClient.Lobby.GetPlayersInRoom((successful, reply, error) => { if (successful) { foreach (SWPlayer swPlayer in reply.players) { string playerName = swPlayer.GetCustomDataString(); string playerId = swPlayer.id; if (playerId.Equals(NetworkClient.Instance.PlayerId)) { localPlayer.PlayerId = playerId; localPlayer.PlayerName = playerName; } else { remotePlayer.PlayerId = playerId; remotePlayer.PlayerName = playerName; } } gameDataManager = new GameDataManager(localPlayer, remotePlayer, NetworkClient.Lobby.RoomId); netCode.EnableRoomPropertyAgent(); } else { Debug.Log("Failed to get players in room."); } }); }