コード例 #1
0
    // Use this for initialization
    void Start()
    {
        _manager = GameObject.Find("Scripts").GetComponent <PortalLayerManager> ();

        if (GameObject.Find("Scripts").GetComponent <RandomMatchmaker> ()._Player != null)
        {
            _LocalPlayer = GameObject.Find("Scripts").GetComponent <RandomMatchmaker> ()._Player;

            _Layer = _manager.CheckLayer(_Layer);

            _Layer = _manager.CheckIfOtherPortal(transform.position, _Layer);

            _manager.RegisterPortal(_Layer, this.gameObject);

            _LM ^= (1 << _Layer);

            GetComponent <ignoreCollision>().restoreLayer(_Layer);
            MoveToLayer(transform, _Layer);
            gameObject.layer = 10;
        }
    }
コード例 #2
0
ファイル: PortalLayer.cs プロジェクト: enkilonde/Poject-Slice
    // Use this for initialization
    void Start()
    {
        //GetComponent<PhotonView> ().RPC ("InstantiateCamera", PhotonTargets.All);

        _manager = GameObject.Find("Scripts").GetComponent <PortalLayerManager> ();

        if (GameObject.Find("Scripts").GetComponent <RandomMatchmaker> ()._Player != null)
        {
            _LocalPlayer             = GameObject.Find("Scripts").GetComponent <RandomMatchmaker> ()._Player;
            _camera                  = Instantiate(_CameraPrefab, _LocalPlayer.transform.position + new Vector3(0, 0, 0), _LocalPlayer.transform.rotation) as GameObject;
            _camera.transform.parent = _LocalPlayer.transform;

            RenderTexture _Textu;
            _Textu = new RenderTexture(500, 500, 16);
            _camera.GetComponent <Camera>().targetTexture = _Textu;
            transform.Find("PortalTexture").GetComponent <Renderer>().material.mainTexture = _Textu;

            _Layer = _manager.CheckLayer(_Layer);

            _Layer = _manager.CheckIfOtherPortal(transform.position, _Layer);

            _manager.RegisterPortal(_Layer, this.gameObject);



            _LM ^= (1 << _Layer);
            _camera.GetComponent <Camera>().cullingMask = _LM;


            GetComponent <ignoreCollision>().restoreLayer(_Layer);
            //this.gameObject.layer = _Layer;
            MoveToLayer(transform, _Layer);
            gameObject.layer = 10;

            _PlayerMainCamera = _camera.transform.parent.Find("Camera");
        }
    }