public Camera2Config ConvertToCamera2() { Camera2Config config2 = new Camera2Config(); config2.visibleObject = new visibleObjectsElement(); config2.viewRect = new viewRectElement(); config2.Smoothfollow = new SmoothfollowElement(); config2.follow360 = new Follow360Element(); config2.modmapExtensions = new ModmapExtensionsElement(); config2.targetPos = new targetPosElement(); config2.targetRot = new targetRotElement(); if (transparentWalls) { config2.visibleObject.Walls = Camera2Utils.WallVisiblity.Transparent.ToString(); } else { config2.visibleObject.Walls = Camera2Utils.WallVisiblity.Visible.ToString(); } if (debri == "show") { config2.visibleObject.Debris = true; } else { config2.visibleObject.Debris = false; } config2.visibleObject.UI = HideUI; config2.visibleObject.Avatar = avatar; if (thirdPerson) { config2.type = Camera2Utils.CameraType.Positionable.ToString(); } else { config2.type = Camera2Utils.CameraType.FirstPerson.ToString(); } config2.FOV = fov; config2.layer = layer; config2.renderScale = (renderScale >= 0.99f) ? Math.Max(1.2f, renderScale) : renderScale; config2.antiAliasing = (renderScale >= 0.99f) ? Math.Max(antiAliasing, 2) : antiAliasing; config2.viewRect.x = screenPosX; config2.viewRect.y = screenPosY; config2.viewRect.width = fitToCanvas ? -1 : screenWidth; config2.viewRect.height = fitToCanvas ? -1 : screenHeight; config2.Smoothfollow.position = positionSmooth; config2.Smoothfollow.rotation = rotationSmooth; config2.Smoothfollow.forceUpright = forceFirstPersonUpRight; config2.follow360.enabled = use360Camera; config2.follow360.smoothing = cam360Smoothness; config2.modmapExtensions.moveWithMap = NoodleTrack; config2.targetPos.x = use360Camera ? cam360RightOffset : thirdPerson ? posx : firstPersonPosOffsetX; config2.targetPos.y = use360Camera ? cam360UpOffset : thirdPerson ? posy : firstPersonPosOffsetY; config2.targetPos.z = use360Camera ? cam360ForwardOffset : thirdPerson ? posz : firstPersonPosOffsetZ; config2.targetRot.x = use360Camera ? cam360XTilt : thirdPerson ? angx : firstPersonRotOffsetX; config2.targetRot.y = use360Camera ? cam360YTilt : thirdPerson ? angy : firstPersonRotOffsetY; config2.targetRot.z = use360Camera ? cam360ZTilt : thirdPerson ? angz : firstPersonRotOffsetZ; return(config2); }
public void ConvertFromCamera2(Camera2Config config2) { fov = config2.FOV; antiAliasing = config2.antiAliasing; renderScale = config2.renderScale; cam360Smoothness = config2.follow360.smoothing; if (config2.type == "FirstPerson") { thirdPerson = false; } else { thirdPerson = true; } if (config2.worldCamVisibility != "Hidden") { showThirdPersonCamera = true; } else { showThirdPersonCamera = false; } use360Camera = config2.follow360.enabled; posx = firstPersonPosOffsetX = cam360RightOffset = config2.targetPos.x; posy = firstPersonPosOffsetY = cam360UpOffset = config2.targetPos.y; posz = firstPersonPosOffsetZ = cam360ForwardOffset = config2.targetPos.z; angx = firstPersonRotOffsetX = cam360XTilt = config2.targetRot.x; angy = firstPersonRotOffsetY = cam360YTilt = config2.targetRot.y; angz = firstPersonRotOffsetZ = cam360ZTilt = config2.targetRot.z; NoodleTrack = config2.modmapExtensions.moveWithMap; screenWidth = (int)config2.viewRect.width; if (screenWidth <= 0) { screenWidth = Screen.width; } screenHeight = (int)config2.viewRect.height; if (screenHeight <= 0) { screenHeight = Screen.height; } screenPosX = (int)config2.viewRect.x; screenPosY = (int)config2.viewRect.y; layer = config2.layer; fitToCanvas = false; if (config2.visibleObject.Walls == "Visible") { transparentWalls = false; } else { transparentWalls = true; } avatar = config2.visibleObject.Avatar; if (!config2.visibleObject.Debris) { debri = "show"; } else { debri = "hide"; } HideUI = config2.visibleObject.UI; forceFirstPersonUpRight = config2.Smoothfollow.forceUpright; }