Ejemplo n.º 1
0
    private void Awake()
    {
        portalCamera   = myCamera.GetComponent <PortalCamera>();
        portalTeleport = myCollidPlane.gameObject.GetComponent <PortalTeleporter>();
        player         = GameObject.FindGameObjectWithTag("Player");

        portalCamera.playerCamera = player.gameObject.transform.GetChild(0);
        portalCamera.otherPortal  = otherPortal.transform;
        portalCamera.portal       = this.transform;

        portalTeleport.player   = player.transform;
        portalTeleport.reciever = otherPortal.transform;

        myRenderPlane.gameObject.GetComponent <Renderer>().material = Instantiate(material);
        if (myCamera.targetTexture != null)
        {
            myCamera.targetTexture.Release();
        }

        myCamera.targetTexture = new RenderTexture(Screen.width, Screen.height, 24);
        myAngle = transform.localEulerAngles.y % 360;
        portalCamera.SetMyAngle(myAngle);

        //Debug.Log(gameObject.name + " angle: " + transform.localEulerAngles.y);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Render a Portal frame, assuming that the camera is in front of the Portal and all conditions are met.
        /// </summary>
        /// <param name="camera">The camera rendering the Portal</param>
        /// <param name="nearClipVerts">The vertices of the camera's near clip plane</param>
        private void TryRenderPortal(Camera camera, Vector3[] nearClipVerts)
        {
            if (!TargetPortal)
            {
                return;
            }
            //bool isVisible = false;
            bool isVisible = false;

            //Check if the camera itself is behind the Portal, even if the frustum isn't.

            if (!PortalUtils.IsBehind(camera.gameObject.transform.position, Origin.position, Origin.forward))
            {
                isVisible = true;
            }
            else
            {
                //Checks to see if any part of the camera is in front of the Portal
                foreach (Vector3 v in nearClipVerts)
                {
                    if (!PortalUtils.IsBehind(v, Origin.position, Origin.forward))
                    {
                        isVisible = true;
                        break;
                    }
                }
            }

            if ((isVisible || _cheeseActivated != -1))
            {
                PortalCamera.RenderIntoMaterial(camera, PortalMaterial, MeshRenderer, TargetPortal.MeshRenderer, MeshFilter.mesh, !NonObliqueOverride ? _cheeseActivated == -1 : false, Is3D);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Called when another Portal is sending a camera to this Portal
 /// </summary>
 public void IncomingCamera()
 {
     //Debug.Break();
     _cheeseActivated     = -1;
     _headInPortalTrigger = true;
     UpdateBackPosition();
     UpdateDopplegangers();
     UpdateEffects();
     //TargetPortal.PortalCamera.ForceResetRender();
     PortalCamera.ForceResetRender();
     WakeBufferWall();
     //TargetPortal.TryRenderPortal(_headCamera, _nearClipVertsGlobal);
     //TryRenderPortal(_headCamera, _nearClipVertsGlobal);
 }
Ejemplo n.º 4
0
    private void SetupBackPortalCamera(PortalCamera cam, Transform portal)
    {
        cam.portal = portal.parent.Find("Portal");
        cam.otherPortals.Clear();
        cam.OtherPortal = portal.GetComponent<Portal>().receiver.parent.Find("Portal");
        portal.GetComponent<Portal>().receiver.GetComponent<BackwardPortal>().attachedCamera = cam.transform;
        SetObserverCamera(portal.parent.parent.parent.gameObject, cam.transform);

        GameObject[] indirectConnections = GetConnections(portal.parent.parent.parent);
        foreach (var indirectCon in indirectConnections)
        {
            SetObserverCamera(indirectCon, cam.transform);
        }
    }
Ejemplo n.º 5
0
 /*check if both setmaterial used Etienne Cloutier 08 november*/
 void SetMaterial(GameObject portal, PortalCamera aCamera, Color aColor)
 {
     portal.GetComponentInChildren <PortalCenter>().GetComponent <Renderer>().material        = aCamera.GetMaterial();
     portal.GetComponentInChildren <PortalContour>().GetComponent <Renderer>().material.color = aColor;
 }
Ejemplo n.º 6
0
 private static void SetCameras()
 {
     cameraA = GameObject.FindGameObjectWithTag("CameraA").GetComponent <PortalCamera>();
     cameraB = GameObject.FindGameObjectWithTag("CameraB").GetComponent <PortalCamera>();
 }
Ejemplo n.º 7
0
 public void SetPortalCamera(PortalCamera main, PortalCamera sub)
 {
     SetMainPortalCamera(sub); //名前のつけ方みすった
     SetSubPortalCamera(main);
 }
Ejemplo n.º 8
0
 void SetSubPortalCamera(PortalCamera camera)
 {
     GetSubPortal().SetPortalCamera(camera);
 }
Ejemplo n.º 9
0
 void SetMainPortalCamera(PortalCamera camera)
 {
     GetMainPortal().SetPortalCamera(camera);
 }
Ejemplo n.º 10
0
 public void SetPortalCamera(PortalCamera camera)
 {
     portalCamera = camera;
 }