Пример #1
0
    private void OnRespawnRequest(NetworkMessage netMsg)
    {
        RespawnMessage msg = netMsg.ReadMessage <RespawnMessage>();

        if (msg.isChaser)
        {
            foreignPlayer.transform.position = chaserSpawnPoint.position;
            foreignPlayer.transform.rotation = chaserSpawnPoint.rotation;
        }
        else
        {
            foreignPlayer.transform.position = chasedSpawnPoint.position;
            foreignPlayer.transform.rotation = chasedSpawnPoint.rotation;
        }
    }
Пример #2
0
    public void RespawnPlayers(bool isChaser)
    {
        if (!netJoiner.isHost)
        {
            return;
        }

        if (isChaser)
        {
            localPlayer.transform.position = chaserSpawnPoint.position;
            localPlayer.transform.rotation = chaserSpawnPoint.rotation;
        }
        else
        {
            localPlayer.transform.position = chasedSpawnPoint.position;
            localPlayer.transform.rotation = chasedSpawnPoint.rotation;
        }

        RespawnMessage msg = new RespawnMessage();

        msg.isChaser = !isChaser;
        NetworkServer.SendToClient(foreignPlayer.GetComponent <PlayerController>().connectionToClient.connectionId, RespawnMessage.RespawnType, msg);
    }
Пример #3
0
        public static void Postfix(NetworkMessage msg)
        {
            msg.reader.SeekZero();
            RespawnMessage respawnMessage = msg.ReadMessage <RespawnMessage>();

            GameObject gameObject = ClientScene.FindLocalObject(respawnMessage.m_net_id);

            if (gameObject == null)
            {
                return;
            }
            Player playerFromNetId = gameObject.GetComponent <Player>();

            if (playerFromNetId == null)
            {
                return;
            }

            if (playerFromNetId.isLocalPlayer)
            {
                if (MenuManager.opt_primary_autoswitch == 0 && MPAutoSelection.primarySwapFlag)
                {
                    if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay())
                    {
                        MPAutoSelection.maybeSwapPrimary(true);
                    }
                }

                if (MPAutoSelection.secondarySwapFlag)
                {
                    if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay())
                    {
                        MPAutoSelection.maybeSwapMissiles(true);
                    }
                }
            }
        }