コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
ファイル: LobbyManager.cs プロジェクト: YarickR/gunman
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: LobbyManager.cs プロジェクト: plutoshe/WarlockBrawl
        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);
        }
コード例 #8
0
ファイル: LobbyManager.cs プロジェクト: ZackGill/Coop-RPG
        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);
        }
コード例 #9
0
        /****************************************************************************************************/

        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: LobbyManager.cs プロジェクト: RaymondChen2018/Haven
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
ファイル: LobbyManager.cs プロジェクト: rneogy/lit.haus.unity
        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);
        }