public void OnPhotonInstantiate(PhotonMessageInfo info)
        {
#if hPHOTON2
            if (photonView.IsMine)
            {
#else
            if (photonView.isMine)
            {
#endif
                isLocal = true;
                name    = "HumanoidPun(Local)";

                humanoids = HumanoidNetworking.FindLocalHumanoids();
                if (debug <= HumanoidNetworking.Debug.Info)
                {
                    PhotonLog("Found " + humanoids.Count + " Humanoids");
                }

                if (humanoids.Count <= 0)
                {
                    return;
                }

                foreach (HumanoidControl humanoid in humanoids)
                {
#if hPHOTON2
                    humanoid.nwId = photonView.ViewID;
#else
                    humanoid.nwId = photonView.viewID;
#endif
                    humanoid.humanoidNetworking = this;

                    if (debug <= HumanoidNetworking.Debug.Info)
                    {
                        Debug.Log(humanoid.nwId + ": Send Start Humanoid " + humanoid.humanoidId);
                    }

#if hPHOTON2
                    photonView.RPC("RpcStartHumanoid", RpcTarget.Others, humanoid.nwId, humanoid.humanoidId, humanoid.gameObject.name, humanoid.remoteAvatar.name, humanoid.transform.position, humanoid.transform.rotation, humanoid.physics);
#else
                    photonView.RPC("RpcStartHumanoid", PhotonTargets.Others, humanoid.nwId, humanoid.humanoidId, humanoid.gameObject.name, humanoid.remoteAvatar.name, humanoid.transform.position, humanoid.transform.rotation, humanoid.physics);
#endif
                }

                NetworkingSpawner spawner = FindObjectOfType <NetworkingSpawner>();
                if (spawner != null)
                {
                    spawner.OnNetworkingStarted();
                }
            }
        }
Ejemplo n.º 2
0
        public virtual void OnJoinedRoom()
        {
#endif
            if (playerPrefab != null)
            {
                PhotonNetwork.Instantiate(playerPrefab.name, Vector3.zero, Quaternion.identity, 0);
            }

            if (networkingStarter != null)
            {
                networkingStarter.networkingStatus = NetworkingStarter.NetworkingStatus.Started;
            }

            NetworkingSpawner spawner = FindObjectOfType <NetworkingSpawner>();
            if (spawner != null)
            {
                spawner.OnNetworkingStarted();
            }
        }
Ejemplo n.º 3
0
        public override void OnStartLocalPlayer()
        {
            isLocal = true;
            name    = "HumanoidUnet(Local)";

            humanoids = HumanoidNetworking.FindLocalHumanoids();
            if (debug <= HumanoidNetworking.Debug.Info)
            {
                Debug.Log((int)netId.Value + ": Found " + humanoids.Count + " Humanoids");
            }

            if (humanoids.Count <= 0)
            {
                CmdServerStartNoHumanoid((int)netId.Value);
                return;
            }

            foreach (HumanoidControl humanoid in humanoids)
            {
                humanoid.nwId = (int)netId.Value;
                humanoid.humanoidNetworking = this;

                if (debug <= HumanoidNetworking.Debug.Info)
                {
                    Debug.Log(humanoid.nwId + ": Send Start Humanoid " + humanoid.humanoidId);
                }

                CmdServerStartHumanoid(
                    humanoid.nwId,
                    humanoid.humanoidId,
                    humanoid.gameObject.name,
                    humanoid.remoteAvatar.name,
                    humanoid.transform.position, humanoid.transform.rotation,
                    humanoid.physics);
            }
            NetworkingSpawner spawner = FindObjectOfType <NetworkingSpawner>();

            if (spawner != null)
            {
                spawner.OnNetworkingStarted();
            }
        }