CM3D2.SubScreen.Plugin.SubScreen.showSubCamera C# (CSharp) Method

showSubCamera() private method

private showSubCamera ( ) : void
return void
        private void showSubCamera()
        {
            if (goSubCam != null)
            {

                if (ssParam.bEnabled[PKeyEnable])
                {
                    SetRendererEnabled(goSubCam, true);
                    goSubCam.GetComponent<Camera>().enabled = true;
                    if (ssParam.bEnabled[PKeySubCamera])
                    {
                        goSubCam.GetComponent<Camera>().targetTexture = null;
                        SetRendererEnabled(goSubScreen, false);
                        goSsLight.GetComponent<Light>().enabled = false;
                        SetRendererEnabled(goSsFrontFilter, false);
                    }
                    else
                    {
                        goSubCam.GetComponent<Camera>().targetTexture = rTex;
                        SetRendererEnabled(goSubScreen, true);
                        goSsLight.GetComponent<Light>().enabled = true;
                    }
                    if (ssParam.bEnabled[PKeyAlwaysLookAtFace])
                    {
                        Transform tr = maid.body0.trsHead;
                        goSubCam.transform.position = tr.position;
                        goSubCam.transform.position += tr.TransformDirection(Vector3.up) * ssParam.fValue[PKeyAlwaysLookAtFace][PPropLookAtFaceFront];//前後
                        goSubCam.transform.position += tr.TransformDirection(Vector3.left) * ssParam.fValue[PKeyAlwaysLookAtFace][PPropLookAtFaceUp];//上下
                        goSubCam.transform.position += tr.TransformDirection(Vector3.back) * ssParam.fValue[PKeyAlwaysLookAtFace][PPropLookAtFaceLeft];//左右
                        goSubCam.transform.LookAt(tr);
                    }
                    else if (ssParam.bEnabled[PKeyAlwaysLookAtXxx])
                    {
                        Transform tr = maid.body0.Pelvis.transform;
                        goSubCam.transform.position = tr.position;
                        goSubCam.transform.position += tr.TransformDirection(Vector3.up) * ssParam.fValue[PKeyAlwaysLookAtXxx][PPropLookAtXxxFront];//前後
                        goSubCam.transform.position += tr.TransformDirection(Vector3.left) * ssParam.fValue[PKeyAlwaysLookAtXxx][PPropLookAtXxxUp];//上下
                        goSubCam.transform.position += tr.TransformDirection(Vector3.back) * ssParam.fValue[PKeyAlwaysLookAtXxx][PPropLookAtXxxLeft];//左右
                        goSubCam.transform.LookAt(tr.position);
                    }
                    else if (ssParam.bEnabled[PKeyAlwaysLookAtMaid])
                    {
                        goSubCam.transform.LookAt(maid.body0.trsHead.transform);
                    }
                    else if (ssParam.bEnabled[PKeySubCamera])
                    {
                        goSubCam.transform.position = new Vector3(ssParam.fValue[PKeySubCamera][PPropSubCameraLocX],
                                                                  ssParam.fValue[PKeySubCamera][PPropSubCameraLocY],
                                                                  ssParam.fValue[PKeySubCamera][PPropSubCameraLocZ]);
                        goSubCam.transform.eulerAngles = new Vector3(ssParam.fValue[PKeySubCamera][PPropSubCameraAngX],
                                                                     ssParam.fValue[PKeySubCamera][PPropSubCameraAngY],
                                                                     ssParam.fValue[PKeySubCamera][PPropSubCameraAngZ]);
                    }
                    if (ssParam.bEnabled[PKeyAlwaysScreenOnMainCamera])
                    {
                        Transform tr = GameMain.Instance.MainCamera.transform;
                        goSubScreen.transform.position = tr.position;
						float offsetSubScreen = 1f;
						if (isVR) {
							offsetSubScreen = 3f;
						}
						goSubScreen.transform.position += tr.TransformDirection(Vector3.forward) * ssParam.fValue[PKeyAlwaysScreenOnMainCamera][PPropAlwaysScreenOnMainCameraFront] / offsetSubScreen;
                        goSubScreen.transform.LookAt(tr);
						goSubScreen.transform.position += goSubScreen.transform.TransformDirection(Vector3.up) * ssParam.fValue[PKeyAlwaysScreenOnMainCamera][PPropAlwaysScreenOnMainCameraUp] / offsetSubScreen;
						goSubScreen.transform.position += goSubScreen.transform.TransformDirection(Vector3.left) * ssParam.fValue[PKeyAlwaysScreenOnMainCamera][PPropAlwaysScreenOnMainCameraLeft] / offsetSubScreen;
                    }
                }
                else
                {
                    SetRendererEnabled(goSubCam, false);
                    goSubCam.GetComponent<Camera>().enabled = false;
                    SetRendererEnabled(goSubScreen, false);
                    SetRendererEnabled(goSsFrontFilter, false);
                }
            }
        }