// public PhotonView photonviewplayerphoton;
    #endregion

    #region Unity Callbacks
    void Awake()
    {
        playerPhotonInstance = this;
        if (playerPhotonInstance != null && playerPhotonInstance != this)
        {
            Destroy(this.gameObject);
        }

        playerPhotonInstance = this;
        DontDestroyOnLoad(this.gameObject);
    }
示例#2
0
    void ActivatePlayer(GameObject player)
    {
        Camera camera = player.transform.GetComponentInChildren <Camera>();
        RigidbodyFirstPersonController playerScript = player.transform.GetComponent <RigidbodyFirstPersonController>();
        PlayerPhoton playerPhoton    = player.transform.GetComponent <PlayerPhoton>();
        Rigidbody    playerRigidbody = player.transform.GetComponent <Rigidbody>();

        camera.enabled       = true;
        playerScript.enabled = true;
        playerPhoton.enabled = true;

        playerRigidbody.constraints = RigidbodyConstraints.None;
        playerRigidbody.constraints = RigidbodyConstraints.FreezeRotation;
    }