예제 #1
0
파일: PortalWorld.cs 프로젝트: efwen/ASL
    // 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);
    }
예제 #2
0
    //PlayerRegisterPortal
    //Try to register the portal with the PortalManager
    public void PlayerRegisterPortal(GameObject portalGO)
    {
        Portal portal = portalGO.GetComponent <Portal>();

        if (portal != null)
        {
            portalManager.RequestRegisterPortal(portal);
        }
        else
        {
            Debug.LogError("Object [" + portalGO.name + "] is not a portal! cannot register!");
        }
    }
예제 #3
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);
         }
     }
 }