void InitPlayerCameraPauseBool() { //If current scene is in MainLevel_PabloCamacho or MainLevel if (SceneManager.GetActiveScene().name.Contains("MainLevel") && MultiplayerManager.IsClient()) { //get reference to player component BoatMovementNetworked Player thisPlayer = MultiplayerManager.GetLocalPlayer(); GameObject thisPlayerGameObject = thisPlayer.GetPlayerObject(); if (thisPlayerGameObject == null) { return; } playerBoatMovementComponent = thisPlayerGameObject.GetComponentInChildren <BoatMovementNetworked>(); } }
public void RpcConsumePack(NetworkInstanceId player) { GameObject playerBoat = ClientScene.FindLocalObject(player); Health playerHealth = playerBoat.GetComponent <Health>(); //play sounds and send command for ammo if (MultiplayerManager.GetLocalPlayer() != null && MultiplayerManager.GetLocalPlayer().objectId == playerBoat.GetComponent <NetworkIdentity>().netId) { playerBoat.transform.Find("ShipSounds").Find("AmmoPickupVO").GetComponent <AudioSource>().Play(); //Debug.Log(MultiplayerManager.GetLocalPlayer().name); } Instantiate(playerHealth.powerupParticle, playerBoat.transform).transform.localPosition = Vector3.zero; playerBoat.transform.Find("ShipSounds").Find("AmmoPickup").GetComponent <AudioSource>().Play(); packMesh.material = offMat; packCollider.enabled = false; }
// Use this for initialization void Start() { instance = this; //Variable initialization manager = MultiplayerManager.GetInstance(); //This if statement statement checks if it's running on the host if (!MultiplayerManager.IsHost()) { startButton.SetActive(false); gameOptions.SetActive(false); } else { CmdSetHostName(MultiplayerManager.GetLocalPlayer().name); CmdSetHostIP(MultiplayerManager.GetLocalIPAddress(), "Fetching..."); StartCoroutine(GetAssignPublicIPAddress()); } OnHostNameChange(hostName); OnHostPubIPChange(hostPublicIP); OnHostLANIPChange(hostLANIP); }
bool IsLocalPlayer() { return(MultiplayerManager.IsClient() && transform.parent.GetComponent <NetworkIdentity>().netId == MultiplayerManager.GetLocalPlayer().objectId); }