public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (SceneManager.GetActiveScene().name == "Moon") { TerrainGenerator tg = GameObject.Find("Terrain").GetComponent <TerrainGenerator>(); Vector3 pos = tg.getSpawnPoint(); gamePlayer.transform.position = pos; } if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } LobbyPlayer l = lobbyPlayer.GetComponent <LobbyPlayer>(); PlayerStatus s = gamePlayer.GetComponent <PlayerStatus>(); s.OnMyIndex(LobbyPlayerList._instance.GetPlayerIndex(l)); s.OnMyName(l.playerName); return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } return(true); }
/// <summary>Lobbyで決めた色設定はここで引き継げる</summary> public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayerObj, GameObject gamePlayer) { if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayerObj, gamePlayer); } PlayerPointer pPointer = gamePlayer.GetComponent <PlayerPointer>(); LobbyPlayer lPlayer = lobbyPlayerObj.GetComponent <LobbyPlayer>(); pPointer.playerColor = lPlayer.playerColor; return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } gamePlayer.GetComponent <PlayerController>().SetPlayerName(lobbyPlayer.GetComponent <LobbyPlayer>().playerName); return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { // 记录大厅玩家和游戏中玩家的对应关系: _lobbyToGamePlayers[lobbyPlayer.GetComponent <LobbyPlayer>()] = gamePlayer.GetComponent <GamePlayer>(); _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } Debug.Log("aaaaaa"); MyGameManager.Instance.addPlayerData(gamePlayer, lobbyPlayer.GetComponent <LobbyPlayer>()); gamePlayer.GetComponent <PlayerInfo>().m_color = lobbyPlayer.GetComponent <LobbyPlayer>().playerColor; return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } LobbyPlayer lobby = lobbyPlayer.GetComponent <LobbyPlayer>(); Health health = gamePlayer.GetComponentInChildren <Health> (); health.playerName = lobby.playerName; health.playerColor = lobby.playerColor; return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { LobbyPlayer player = lobbyPlayer.GetComponent <LobbyPlayer>(); PlayerMovement gamePlayerObject = gamePlayer.GetComponent <PlayerMovement>(); gamePlayerObject.charName = player.playerName; //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } return(true); }
/****************************************************************************************************/ public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. LobbyPlayer lp = lobbyPlayer.GetComponent <LobbyPlayer>(); int my_id = lp.slot; // get player id [0-4] gamePlayer.gameObject.name = "[" + my_id + "] " + lp.playerName; // pass id through obj name gamePlayer.GetComponent <Image>().color = lp.playerColor; // set image to use for username color if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } var carC = gamePlayer.GetComponent <Game.Car.CarController>(); var lobbyC = lobbyPlayer.GetComponent <LobbyPlayer>(); carC.playerColor = lobbyC.playerColor; carC.playerName = lobbyC.playerName; return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. var lobbyPlayerId = lobbyPlayer.GetComponent <NetworkIdentity>().netId.ToString(); var gamePlayerId = lobbyPlayer.GetComponent <NetworkIdentity>().netId.ToString(); //We assign the lobbyPlayerID to the playerID of the gameObject //This is so we can track the player from in the manager and the game gamePlayer.GetComponent <PlayerController>().myPlayerID = lobbyPlayer.GetComponent <LobbyPlayer>().lobbyPlayerID; Debug.Log("LobbyManager. OnLobbyServerSceneLoadedForPlayer. netId lobbyPlayer: " + lobbyPlayerId + " and netId gamePlayer: " + gamePlayerId); if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. //If in-game players if (gamePlayer.GetComponent <Body_generic>() != null) { gamePlayer.GetComponent <Body_generic>().set_player_name(lobbyPlayer.GetComponent <LobbyPlayer>().playerName); gamePlayer.GetComponent <Body_generic>().set_player_color(lobbyPlayer.GetComponent <LobbyPlayer>().playerColor); } if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. int prefabindex = lobbyPlayer.GetComponent <LobbyPlayer>().charindex; GameObject playerPrefab = (GameObject)Instantiate(spawnPrefabs[prefabindex]); NetworkServer.AddPlayerForConnection(lobbyPlayer.GetComponent <NetworkIdentity>().connectionToClient, playerPrefab, (short)Random.Range(0, 32)); Destroy(gamePlayer); if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, playerPrefab); } return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } //if(lobber.playerColor == Color.blue) //{ // obj.tag = "blue"; //} //if (lobber.playerColor == Color.red) //{ // obj.tag = "red"; //} return(true); }
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { //This hook allows you to apply state data from the lobby-player to the game-player //just subclass "LobbyHook" and add it to the lobby object. if (_lobbyHooks) { _lobbyHooks.OnLobbyServerSceneLoadedForPlayer(this, lobbyPlayer, gamePlayer); } GetComponent <GameController>().InstantiateRooms(); if (lobbyPlayer.GetComponent <LobbyPlayer>().isFirefighter) { gamePlayer.GetComponent <CorePlayerController>().SetFirefighter(true); } else { gamePlayer.transform.Translate(Random.Range(-9, 9), Random.Range(-9, 9), 0); } return(true); }