Example #1
0
    // Use this for initialization
    /// <summary>
    /// Initialize the PortalWorld. It creates and registers a new portal with the
    /// portal manager, and adds it as a child in the world manager.
    /// </summary>
    public override void Init()
    {
        base.Init();

        //instantiate a portal as well if we are the master client
        if (network.MasterClient &&
            PhotonNetwork.inRoom &&
            defaultPortalXform != null)
        {
            defaultPortal = portalManager.MakePortal(defaultPortalXform.position, defaultPortalXform.forward, defaultPortalXform.up, defaultPortalViewType);
            portalManager.RequestRegisterPortal(defaultPortal);
            worldManager.AddToWorld(this, defaultPortal.gameObject);
        }
        else if (PhotonNetwork.inRoom && defaultPortalXform != null)
        {
            Portal portal = GetComponentInChildren <Portal>();
            if (portal != null)
            {
                defaultPortal = portal;
            }
            else
            {
                Debug.Log("No default portal found for World: " + gameObject.name);
            }
        }

        //Initialize the portal selector
        Camera cam = Camera.main;

        Debug.Assert(defaultPortal != null);
        selector.Initialize(cam, defaultPortal);
    }
Example #2
0
 // Use this for initialization
 /// <summary>
 /// Initialize the World. It creates and registers a new portal with the
 /// portal manager, and adds it as a child in the world manager.
 /// </summary>
 public virtual void Init()
 {
     //instantiate a portal as well if we are the master client
     if (network.MasterClient &&
         PhotonNetwork.inRoom &&
         defaultPortalXform != null)
     {
         defaultPortal = portalManager.MakePortal(defaultPortalXform.position, defaultPortalXform.forward, defaultPortalXform.up, defaultPortalViewType);
         portalManager.RequestRegisterPortal(defaultPortal);
         worldManager.AddToWorld(this, defaultPortal.gameObject);
     }
     else if (PhotonNetwork.inRoom && defaultPortalXform != null)
     {
         Portal portal = GetComponentInChildren <Portal>();
         if (portal != null)
         {
             defaultPortal = portal;
         }
         else
         {
             Debug.Log("No default portal found for World: " + gameObject.name);
         }
     }
 }
Example #3
0
 //PlayerCreatePortal
 //Try to create a portal where the player camera is looking at on the plane
 public void PlayerCreatePortal(Vector3 position, Vector3 forward, Vector3 up, Portal.ViewType vType = Portal.ViewType.VIRTUAL)
 {
     portalManager.MakePortal(position, forward, up, vType);
 }