示例#1
0
 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>();
     }
 }
示例#2
0
    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;
    }
示例#3
0
    // 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);
    }
示例#4
0
 bool IsLocalPlayer()
 {
     return(MultiplayerManager.IsClient() && transform.parent.GetComponent <NetworkIdentity>().netId == MultiplayerManager.GetLocalPlayer().objectId);
 }