// Update is called once per frame void Update() { if(Input.GetKeyDown(KeyCode.Tab)){ cameraIndex++; if (cameraIndex >= cameraTargets.Length) cameraIndex = 0; } cameraSettings = cameraTargets[cameraIndex].GetComponent<CameraSettings>(); if (cameraTargets[cameraIndex]){ if(cameraSettings.smoothing == 0f){ transform.position = cameraTargets[cameraIndex].position; transform.rotation = cameraTargets[cameraIndex].rotation; } else{ transform.position = Vector3.Lerp (transform.position, cameraTargets[cameraIndex].position, Time.deltaTime * cameraSettings.smoothing); transform.rotation = cameraTargets[cameraIndex].rotation; } cameraRotX -= Input.GetAxis ("Mouse Y"); cameraRotX = Mathf.Clamp(cameraRotX, -cameraSettings.cameraPitchMax, cameraSettings.cameraPitchMax); Camera.main.transform.Rotate (cameraRotX,0.0F , 0.0F); } }
void Update() { // Pressing the camera button ("C" on the keyboard or "X" on a controller) lets you cycle between cameras if (Input.GetKeyDown(KeyCode.C) || Input.GetKeyDown(KeyCode.JoystickButton9)) { cameraIndex++; if (cameraIndex >= cameraTargets.Length) cameraIndex = 0; // Sets the camera settings to be of the current selected camera cameraSettings = cameraTargets[cameraIndex].GetComponent<CameraSettings>(); } // If we don't have camera smooting, the camera will just instantly take the position of the current camera target if (cameraSettings.smoothing == 0f) { transform.position = cameraTargets[cameraIndex].position; transform.rotation = cameraTargets[cameraIndex].rotation; } // Otherwise we use a lerp-function to slowly smoothen the camera into its position. Higher smoothing = faster lock. else { transform.position = Vector3.Lerp(transform.position, cameraTargets[cameraIndex].position, Time.deltaTime * cameraSettings.smoothing); transform.rotation = cameraTargets[cameraIndex].rotation; } // Store the value of the player wanting to look up and down with the camera cameraRotX -= Input.GetAxis("Mouse Y"); // Makes sure the value is not higher or lower than the value set in the camera settings cameraRotX = Mathf.Clamp(cameraRotX, -cameraSettings.cameraPitchMax, cameraSettings.cameraPitchMax); // Rotate the camera up and down Camera.main.transform.Rotate(cameraRotX, 0f, 0f); }
public CameraManager(GameScreen parent, CameraType cameraType, CameraSettings settings) : base(parent) { Settings = settings; Engine.Services.RegisterService(typeof(CameraManager), this); Viewport = Engine.GraphicsDevice.Viewport; Input = (Input)Engine.Services.GetService(typeof(Input)); SetCamera(cameraType); }
// Update is called once per frame void Update() { if (Input.GetKeyDown (KeyCode.Tab)) { cameraIndex++; if (cameraIndex >= cameraTargets.Length) cameraIndex = 0; cameraSettings = cameraTargets[cameraIndex].GetComponent<CameraSettings> (); } if (cameraTargets[cameraIndex]) { if (cameraSettings.newCameraType) { } else { if (cameraSettings.smoothing == 0f) { transform.position = cameraTargets[cameraIndex].position; } else { transform.position = Vector3.Lerp (transform.position, cameraTargets[cameraIndex].position, Time.deltaTime * cameraSettings.smoothing); } if (cameraSettings.rotatable) { transform.rotation = cameraTargets[cameraIndex].rotation; } else { if (transform.rotation != cameraTargets[cameraIndex].rotation) { transform.rotation = Quaternion.Lerp (transform.rotation, cameraTargets[cameraIndex].rotation, Time.deltaTime * cameraSettings.smoothing); } } if (cameraSettings.rotatable) { cameraRotX -= Input.GetAxis ("Mouse Y") * turnSpeed * Time.deltaTime; cameraRotX = Mathf.Clamp(cameraRotX, -cameraSettings.cameraPitchMax, cameraSettings.cameraPitchMax); //Camera.main.transform.forward = transform.forward; Camera.main.transform.Rotate (cameraRotX, 0f, 0f); } } } }
public void getCameraPerspective() { // if user right clicks, zoom in if (Input.GetKeyDown(KeyCode.Mouse1)) // { cameraIndex++; overtheshoulder = true; Debug.Log("Camera switched"); if (cameraIndex >= cameraPerspective.Length) { cameraIndex = 0; overtheshoulder = false; } } camerasettings = cameraPerspective[cameraIndex].GetComponent<CameraSettings>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { cameraIndex++; Debug.Log("Camera switched"); if (cameraIndex >= cameraPerspective.Length) { cameraIndex = 0; } camerasettings = cameraPerspective[cameraIndex].GetComponent<CameraSettings>(); } if (cameraPerspective[cameraIndex]) { //disable smoothing if smoothing is zero if (camerasettings.smoothing == 0f) { //snap to position transform.position = cameraPerspective[cameraIndex].position; transform.rotation = cameraPerspective[cameraIndex].rotation; } else { //the higher the smoothing is the faster the camera will be in position transform.position = Vector3.Lerp(transform.position, cameraPerspective[cameraIndex].position, Time.deltaTime * camerasettings.smoothing); transform.rotation = cameraPerspective[cameraIndex].rotation; } //this stores rotation independently, tracks rotation frame to frame cameraRotationX -= Input.GetAxis("Mouse Y"); //clamp, set cameraPitch min -45 max 45 degs cameraRotationX = Mathf.Clamp(cameraRotationX, -camerasettings.cameraPitchMax, camerasettings.cameraPitchMax); //Apply rotation to Camera Camera.main.transform.Rotate(cameraRotationX, 0f, 0f); } }
public void SetCameraSettings(CameraSettings cameraSettings) { _currentCameraSettings = cameraSettings; }
public static void SetSettings(CameraSettings settings) { _cameraSettings = settings; _dslrCamera?.Dispose(); _dslrCamera = null; }
public override void OnMouseMove(Vector2 mouse) { base.OnMouseMove(mouse); if (modify_Activated && !Viewport.MouseRelativeMode) { UpdateCursorTransitionOnScreenBorder(); Vector2 viewportSize = Owner.ViewportControl.Viewport.SizeInPixels.ToVector2(); Vector2 mousePosition = mouse + cursorTransitionOnScreenBorderOffset / viewportSize; Vector2 screenPosition = mousePosition - startMouseOffset; Ray ray = CameraSettings.GetRayByScreenCoordinates(screenPosition); Vector3 position = modifyPosition; double size = GetSize(); if (size == 0) { return; } Vector3 xOffset, yOffset, zOffset; GetAxisOffsets(out xOffset, out yOffset, out zOffset); double offset = 0; if (!double.IsNaN(ray.Direction.X)) { Vector2 pixelOffset = (mousePosition - startMousePosition) * viewportSize; double mouseOffsetAngle = Math.Atan2(-pixelOffset.Y, pixelOffset.X); if (selectedAxes.TrueCount == 3) { offset = mousePosition.Y - startMousePosition.Y; offset *= -1; offset *= viewportSize.Y; } else { Vector2 screenModifyPosition; if (CameraSettings.ProjectToScreenCoordinates(modifyPosition, out screenModifyPosition)) { screenModifyPosition *= viewportSize; offset = 0; if (selectedAxes.x) { Vector2 screenXPosition; CameraSettings.ProjectToScreenCoordinates(position + xOffset, out screenXPosition); if (screenXPosition.X != 0 && screenXPosition.Y != 0) { screenXPosition *= viewportSize; Vector2 diff = screenXPosition - screenModifyPosition; double diffAngle = Math.Atan2(-diff.Y, diff.X); double angle = mouseOffsetAngle - diffAngle; angle = MathEx.RadianNormalize360(angle); double off = Math.Cos(angle) * pixelOffset.Length(); offset += off; } } if (selectedAxes.y) { Vector2 screenYPosition; CameraSettings.ProjectToScreenCoordinates(position + yOffset, out screenYPosition); if (screenYPosition.X != 0 && screenYPosition.Y != 0) { screenYPosition *= viewportSize; Vector2 diff = screenYPosition - screenModifyPosition; double diffAngle = Math.Atan2(-diff.Y, diff.X); double angle = mouseOffsetAngle - diffAngle; angle = MathEx.RadianNormalize360(angle); double off = Math.Cos(angle) * pixelOffset.Length(); offset += off; } } if (selectedAxes.z) { Vector2 screenZPosition; CameraSettings.ProjectToScreenCoordinates(position + zOffset, out screenZPosition); if (screenZPosition.X != 0 && screenZPosition.Y != 0) { screenZPosition *= viewportSize; Vector2 diff = screenZPosition - screenModifyPosition; double diffAngle = Math.Atan2(-diff.Y, diff.X); double angle = mouseOffsetAngle - diffAngle; angle = MathEx.RadianNormalize360(angle); double off = Math.Cos(angle) * pixelOffset.Length(); offset += off; } } } } const double scaleCoefficient = .01f; offset *= scaleCoefficient; double coef; if (offset > 0) { double snap = Owner.GetSnapScale(); if (snap != 0) { offset += snap / 2; offset /= snap; offset = (int)offset; offset *= snap; } coef = offset + 1.0f; } else { double snap = Owner.GetSnapScale(); if (snap != 0) { offset -= snap / 2; offset /= snap; offset = (int)offset; offset *= snap; } coef = 1.0f / (1.0f - offset); } Vector3 scaleOffset = new Vector3(selectedAxes.x ? coef : 1, selectedAxes.y ? coef : 1, selectedAxes.z ? coef : 1); //update objects if (initialObjectsTransform != null && Owner.Objects.Count == initialObjectsTransform.Length) { Owner.OnScaleModeUpdateObjects(initialObjectsTransform, modifyPosition, scaleOffset); } helpText = string.Format("[{0} {1} {2}]", scaleOffset.X.ToString("F2"), scaleOffset.Y.ToString("F2"), scaleOffset.Z.ToString("F2")); } } }
public void setCameraSettings(CameraSettings settings) { camSettings.assignSettings(settings); }
protected void InitializeAndStartBarcodeScanning() { // Create data capture context using your license key. this.dataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY); // Use the default camera and set it as the frame source of the context. // The camera is off by default and must be turned on to start streaming frames to the data // capture context for recognition. // See resumeFrameSource and pauseFrameSource below. this.camera = Camera.GetDefaultCamera(); if (this.camera != null) { // Use the settings recommended by barcode capture. this.dataCaptureContext.SetFrameSourceAsync(this.camera); } // Use the recommended camera settings for the BarcodeTracking mode as default settings. // The preferred resolution is automatically chosen, which currently defaults to HD on all devices. CameraSettings cameraSettings = BarcodeTracking.RecommendedCameraSettings; // Setting the preferred resolution to full HD helps to get a better decode range. cameraSettings.PreferredResolution = VideoResolution.FullHd; camera?.ApplySettingsAsync(cameraSettings); BarcodeTrackingSettings barcodeTrackingSettings = BarcodeTrackingSettings.Create(); // The settings instance initially has all types of barcodes (symbologies) disabled. // For the purpose of this sample we enable a very generous set of symbologies. // In your own app ensure that you only enable the symbologies that your app requires as // every additional enabled symbology has an impact on processing times. HashSet <Symbology> symbologies = new HashSet <Symbology>() { Symbology.Ean13Upca, Symbology.Ean8, Symbology.Upce, Symbology.Code39, Symbology.Code128 }; barcodeTrackingSettings.EnableSymbologies(symbologies); // Create new barcode tracking mode with the settings from above. this.barcodeTracking = BarcodeTracking.Create(this.dataCaptureContext, barcodeTrackingSettings); // Register self as a listener to get informed whenever a new barcode got recognized. this.barcodeTracking.AddListener(this); // To visualize the on-going barcode tracking process on screen, setup a data capture view // that renders the camera preview. The view must be connected to the data capture context. var dataCaptureView = DataCaptureView.Create(this.dataCaptureContext, this.View.Bounds); dataCaptureView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; var overlay = BarcodeTrackingBasicOverlay.Create(this.barcodeTracking, dataCaptureView); overlay.Listener = this; this.defaultBrush = overlay.Brush; var rejectedColor = new UIColor(red: 255 / 255, green: 57 / 255, blue: 57 / 255, alpha: 1); this.rejectedBrush = new Brush(fillColor: rejectedColor.ColorWithAlpha((nfloat)0.3), strokeColor: rejectedColor, strokeWidth: 1); this.View.AddSubview(dataCaptureView); this.View.SendSubviewToBack(dataCaptureView); }
public void UpdateMainBuffers() { for(int i = 0; i < cameraSettings.Length; i++) { CameraSettings cameraSetting = cameraSettings[i]; if (cameraSetting.renderMode == CameraSettings.RenderMode.Disabled) { continue; } LightingMainBuffer2D buffer = LightingMainBuffer2D.Get(cameraSetting); if (buffer != null) { buffer.cameraSettings.renderMode = cameraSetting.renderMode; buffer.cameraSettings.renderLayerId = cameraSetting.renderLayerId; if (buffer.cameraSettings.customMaterial != cameraSetting.customMaterial) { buffer.cameraSettings.customMaterial = cameraSetting.customMaterial; buffer.ClearMaterial(); } if (buffer.cameraSettings.renderShader != cameraSetting.renderShader) { buffer.cameraSettings.renderShader = cameraSetting.renderShader; buffer.ClearMaterial(); } foreach(Material material in cameraSetting.GetMaterials().materials) { if (material == null) { continue; } Camera camera = cameraSetting.GetCamera(); if (cameraSetting.cameraType == CameraSettings.CameraType.SceneView) { CameraMaterials.SetMaterial(2, material, camera, buffer.renderTexture); } else { CameraMaterials.SetMaterial(1, material, camera, buffer.renderTexture); } } } } for(int i = 0; i < LightingMainBuffer2D.List.Count; i++) { LightingMainBuffer2D buffer = LightingMainBuffer2D.List[i]; if (buffer != null) { buffer.Update(); } } if (LightingMainBuffer2D.List.Count > 0) { foreach(LightingMainBuffer2D buffer in LightingMainBuffer2D.List) { if (Lighting2D.disable) { buffer.updateNeeded = false; return; } CameraSettings cameraSettings = buffer.cameraSettings; bool render = cameraSettings.renderMode != CameraSettings.RenderMode.Disabled; if (render && cameraSettings.GetCamera() != null) { buffer.updateNeeded = true; } else { buffer.updateNeeded = false; } } } }
void Awake() { Instance = this; InitializeKeys(); }
void Init(CameraSettings settings) { this.settings = settings; }
/// <summary> /// Returns the current settings. /// </summary> public void GetSettings(out CameraSettings outSettings) { outSettings = new CameraSettings(Height, Zoom, m_LastDistance, ZoomedHeight(), m_Camera.fieldOfView); }
public Level2() : base() { width = 35; height = 55; cameraSettings = new CameraSettings(new Vector3(4f, 20f, -15f), new Vector3(60f, 0f, 0f), 2.5f, 2.5f); player = new Player(1, 1); walls = new Wall[] { // new Wall(x1, z1, x2, z2) // 1:start from x > 2:start from z ^ // 3: > 4:^ new Wall(0, 0, 37, 0), // Bottom Wall new Wall(0, 0, 0, 57), // Left Wall new Wall(36, 0, 37, 57), // Right Wall new Wall(0, 56, 37, 57), // Top Wall new Wall(0, 4, 20, 4), // Internal Wall: start // new Wall(22, 0, 22, 8), // *** Bouncy Wall new Wall(6, 12, 27, 13), //wall: L // new Wall(6, 12, 6, 20),// *** Bouncy Wall // new Wall(0, 24, 17, 25),//*** Bouncy Wall: second that protrudes from left wall // new Wall(23, 24, 32, 25),// *** Bouncy Wall: wall opposite new Wall(17, 20, 18, 30), //wall: T new Wall(17, 20, 29, 21), // wall: upside down L new Wall(29, 7, 30, 21), // wall: upside down L new Wall(17, 30, 27, 31), //wall: protrude right from corridor //final stretch new Wall(13, 34, 32, 35), new Wall(13, 30, 14, 34), new Wall(13, 30, 14, 34), new Wall(4, 30, 13, 31), new Wall(3, 30, 4, 52), // new Wall(3, 52, 33, 53),// *** Bouncy Wall //fast/hard corridor // new Wall(26, 3, 27, 12), // *** Bouncy Wall // new Wall(26, 3, 32, 4), // *** Bouncy Wall // new Wall(32, 3, 33, 52),// *** Bouncy Wall }; wallsBouncy = new WallBouncy[] { new WallBouncy(22, 0, 22, 8), new WallBouncy(6, 12, 6, 20), new WallBouncy(0, 24, 17, 25), new WallBouncy(23, 24, 32, 25), new WallBouncy(3, 52, 33, 53), new WallBouncy(26, 3, 27, 12), new WallBouncy(26, 3, 32, 4), new WallBouncy(32, 3, 33, 52), }; goals = new Goal[] { new Goal(33, 53) }; obstacles = new Obstacle[] { //place 2 holes near beginning //place 2 holes at end for either side depending on which side you take new Hole(17, 1), new Hole(17, 6), new Hole(10, 4), new Hole(0, 12), new Hole(5, 20), new Hole(12, 15), new Hole(25, 17), new Hole(26, 3), new Hole(22, 26), new Hole(24, 26), new Hole(26, 26), new Hole(28, 26), //final stretch new Hole(12, 26), new Hole(3, 24), new Hole(31, 53), //fast/hard corridor new Hole(22, 6), new Hole(23, 3), new Hole(22, 1), //final stretch of fast/hard new Hole(32, 0), new Hole(33, 4), new Hole(33, 6), new Hole(33, 8), new Hole(33, 10), new Hole(32, 14), new Hole(32, 16), new Hole(33, 20), new Hole(33, 22), new Hole(33, 24), new Hole(33, 26), new Hole(32, 30), new Hole(32, 32), new Hole(33, 36), new Hole(33, 38), new Hole(33, 40), new Hole(33, 42), new Hole(33, 44), new Hole(32, 48), new Hole(33, 51), }; introDialogue = new Dialogue[] { new Dialogue(9, Dialogue.Speaker.Rubik, "Welcome To Level 2 Torture!!"), new Dialogue(5, Dialogue.Speaker.Rubik, "You may have survived thus far, but we’re just getting started!"), new Dialogue(5, Dialogue.Speaker.Rubik, "MORE WALLS, MORE DANGER!!!!"), }; outroDialogue = new Dialogue[] { new Dialogue(5, Dialogue.Speaker.Rubik, "AGH!!! You won't be able to get aROUND us next time!"), }; failDialogue = new Dialogue[] { new Dialogue(70, Dialogue.Speaker.Rubik, "Humpty Dumpty bumped into my walls & Humpty Dumpty had a great fall"), new Dialogue(70, Dialogue.Speaker.Rubik, "All the king's horses and all the king's men, couldn't put Humpty together again"), new Dialogue(70, Dialogue.Speaker.Rubik, "You my good broken Spherical General are now like Humpty Dumpty! HAHAHAHA"), new Dialogue(70, Dialogue.Speaker.King, "Well done Rubik! Just like how I like my eggs."), }; buildMap(); }
public void Render(ScriptableRenderContext IN_context, Camera IN_camera, CameraBufferSettings cameraBufferSettings, bool useDynameicBatching, bool useGPUInstancing, bool useLightPerObject, ShadowSettings shadowSetting, PostFXSettings postFXSettings, int colorLUTResolution) { this.context = IN_context; this.camera = IN_camera; //setup custom camera settings //for per camera blend, PostFX settings var crpCamera = camera.GetComponent<CustomRenderPipelineCamera>(); CameraSettings cameraSettings = crpCamera ? crpCamera.Settings : defaultCameraSettings; //use depthtexture so shader can access the current buffer depth if (camera.cameraType == CameraType.Reflection) { useDepthTexture = cameraBufferSettings.copyDepthReflection; useColorTexture = cameraBufferSettings.copyColorReflection; } else { useDepthTexture = cameraBufferSettings.copyDepth && cameraSettings.copyDepth; useColorTexture = cameraBufferSettings.copyColor && cameraSettings.copyColor; } if (cameraSettings.overridePostFX) { //override PostFX option for each cam postFXSettings = cameraSettings.postFXSettings; } //set render scale, scale should atleast move a bit to take effect float renderScale = cameraSettings.GetRenderScale(cameraBufferSettings.renderScale); useScaledRendering = renderScale < 0.99f || renderScale > 1.01f; //change buffer name to the camera name PrepareBuffer(); //add UI (WorldGeometry) to the scene camera, so we can see UI in editor view PrepareForSceneView(); if (!Cull(shadowSetting.maxDistance)) { return; } this.useHDR = cameraBufferSettings.allowHDR && camera.allowHDR; //calculate and store buffersize if (useScaledRendering) { renderScale = Mathf.Clamp(renderScale, renderScaleMin, renderScaleMax); bufferSize.x = (int)(camera.pixelWidth * renderScale); bufferSize.y = (int)(camera.pixelHeight * renderScale); } else { bufferSize.x = camera.pixelWidth; bufferSize.y = camera.pixelHeight; } buffer.BeginSample(SampleName);//Include lights and shadow rendering in main cam profile //pass the buffer size to GPU so the when sample color and depthe texture, //we can refer to correct buffer size buffer.SetGlobalVector(bufferSizeId, new Vector4( (float)1/bufferSize.x, (float)1 /bufferSize.y, bufferSize.x, bufferSize.y )); ExecuteBuffer(); //get transfer DirLight data to GPU //Setup shadow RT and shadow rendering lighting.Setup(context, cullingResults, shadowSetting, useLightPerObject, cameraSettings.maskLights ? cameraSettings.RenderingLayerMask : -1); //FXAA is enable per camera cameraBufferSettings.fxaa.enabled = cameraSettings.allowFXAA; //setup postFX postFXStack.Setup(context, camera, bufferSize, postFXSettings, cameraSettings.keepAlpha, useHDR, colorLUTResolution, cameraSettings.finalBlendMode, cameraBufferSettings.bicubicResampling, cameraBufferSettings.fxaa); buffer.EndSample(SampleName); //Setup rendertarget for normal oject rendering Setup(); DrawVisibleGeometry(useDynameicBatching, useGPUInstancing, useLightPerObject, cameraSettings.RenderingLayerMask); //this makes the Legacy shader draw upon the tranparent object //makes it wired, but they are not supported who cares~ DrawUnsupportedShaders(); DrawGizmosBeforeFX(); if (postFXStack.IsActive) { postFXStack.Render(colorAttachmentId); } else if (useIntermediateBuffer) { // we need to copy the image from intermediate to final //otherwise nothing goes to camera target, Since PFX is not active //Draw(colorAttachmentId, BuiltinRenderTextureType.CameraTarget); DrawFinal(cameraSettings.finalBlendMode); ExecuteBuffer(); } DrawGizmosAfterFX(); Cleanup(); //all action will be buffered and render action only begin after submit! Submit(); }
private IEnumerator Start() { if (IsStudio()) { StudioHooks.Init(); } yield return(new WaitUntil(() => { switch (KoikatuAPI.GetCurrentGameMode()) { case GameMode.Maker: return KKAPI.Maker.MakerAPI.InsideAndLoaded; case GameMode.Studio: return KKAPI.Studio.StudioAPI.StudioLoaded; case GameMode.MainGame: return null != GameObject.Find("MapScene") && SceneManager.GetActiveScene().isLoaded&& null != Camera.main; //KKAPI doesn't provide an api for in game check default: return false; } })); Settings = new GlobalSettings(); CameraSettings = new CameraSettings(); LightingSettings = new LightingSettings(); PostProcessingSettings = new PostProcessingSettings(CameraSettings.MainCamera); _skyboxManager = Instance.GetOrAddComponent <SkyboxManager>(); _skyboxManager.Parent = this; _skyboxManager.AssetPath = ConfigCubeMapPath.Value; _skyboxManager.Logger = Logger; DontDestroyOnLoad(_skyboxManager); _postProcessingManager = Instance.GetOrAddComponent <PostProcessingManager>(); _postProcessingManager.Parent = this; _postProcessingManager.LensDirtTexturesPath = ConfigLensDirtPath.Value; DontDestroyOnLoad(_postProcessingManager); LocalizationManager.Parent = this; LocalizationManager.CurrentLanguage = ConfigLanguage.Value; _lightManager = new LightManager(this); _focusPuller = Instance.GetOrAddComponent <FocusPuller>(); _focusPuller.init(this); DontDestroyOnLoad(_focusPuller); _presetManager = new PresetManager(ConfigPresetPath.Value, this); _inspector = new Inspector.Inspector(this); // It takes some time to fully loaded in studio to save/load stuffs. yield return(new WaitUntil(() => { return IsStudio() ? KKAPI.Studio.StudioAPI.InsideStudio && _skyboxManager != null : true; })); _isLoaded = true; }
public void SetCamera(CameraType cameraType, CameraSettings settings) { Settings = settings; SetCamera(cameraType); }
private void BuildDatabaseBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { CameraSettings settings = (CameraSettings)e.Argument; LoggingClient logger = new LoggingClient(App.Configuration); logger.Log(settings.Username, "Invoked"); if (Directory.Exists(settings.TargertDrive)) { // Load POIs from PocketGPSWorld this.buildDatabaseBackgroundWorker.ReportProgress(1, "Loading Cameras from PocketGPSWorld.com"); byte[] camerasZip = null; try { camerasZip = SpeedCameras.Load(settings.Username, settings.Password); } catch (WebException webException) { logger.Log(settings.Username, $"Exception (Load) - {webException.Message}"); // Offer the user to build from manual download if (MessageBox.Show(webException.Message + "\r\r" + Properties.Resources.ManualDownloadPrompt, Properties.Resources.ErrorTitle, MessageBoxButton.YesNo, MessageBoxImage.Error, MessageBoxResult.Yes) == MessageBoxResult.Yes) { MessageBox.Show(Properties.Resources.ManualDownloadGuidance, Properties.Resources.ManualDownloadGuidanceTitle, MessageBoxButton.OK, MessageBoxImage.Information); Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog { DefaultExt = ".zip", Filter = "Zip Files|*.zip" }; bool?dialogResult = fileDialog.ShowDialog(); if (dialogResult == true) { string filename = fileDialog.FileName; camerasZip = File.ReadAllBytes(filename); } } } if (camerasZip == null) { return; } SpeedCameras.UploadCameras(settings.Username, camerasZip); Collection <PointOfInterestCategory> cameras = null; try { cameras = SpeedCameras.Filter( SpeedCameras.SortCameras( SpeedCameras.UnpackCameras(camerasZip)), settings); } catch (FileFormatException fileFormatException) { logger.Log(settings.Username, $"Exception (Unpack) - {fileFormatException.Message}"); MessageBox.Show(fileFormatException.Message, Properties.Resources.ErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } // Check we got some Cameras from the PocketGPSWorld if (cameras != null && cameras.Count > 0) { // Load existing POIs from card this.buildDatabaseBackgroundWorker.ReportProgress(2, "Load existing POIs from Card"); Collection <PointOfInterestCategory> existingCategories = PointOfInterestDatabase.LoadPois(settings.TargertDrive); // We need to do a merge Collection <PointOfInterestCategory> mergedPois = PointOfInterestDatabase.MergePointsOfInterest(existingCategories, cameras); // Build the SD card this.buildDatabaseBackgroundWorker.ReportProgress(3, "Building Database"); int loadedWaypoints = PointOfInterestDatabase.SavePois(mergedPois, settings.TargertDrive, this.buildDatabaseBackgroundWorker); e.Result = loadedWaypoints; logger.Log(settings.Username, "Complete"); } } else { e.Result = -1; MessageBox.Show( Properties.Resources.FileNotFoundError, Properties.Resources.ErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RightAlign); } }
// Use this for initialization void Start() { camerasettings = cameraPerspective[cameraIndex].GetComponent<CameraSettings>(); }
public static void SetSettings(CameraSettings settings) { _cameraSettings = settings; }
public async Task <MethodResult <Dictionary <PokemonId, PokemonSettings> > > GetItemTemplates() { if (PokeSettings != null && PokeSettings.Count != 0) { return(new MethodResult <Dictionary <PokemonId, PokemonSettings> > { Data = PokeSettings, Message = "Settings already grabbed", Success = true }); } if (!_client.LoggedIn) { MethodResult result = await AcLogin(); if (!result.Success) { return(new MethodResult <Dictionary <PokemonId, PokemonSettings> > { Message = result.Message }); } } if (_client.ClientSession.Templates.ItemTemplates == null) { return new MethodResult <Dictionary <PokemonId, PokemonSettings> > { Message = "Failed to get setting templates" } } ; var pokemonSettings = new Dictionary <PokemonId, PokemonSettings>(); var moveSettings = new Dictionary <PokemonMove, MoveSettings>(); var badgeSettings = new Dictionary <BadgeType, BadgeSettings>(); var itemSettings = new Dictionary <ItemId, ItemSettings>(); var battleSettings = new GymBattleSettings(); var upgradeSettings = new PokemonUpgradeSettings(); var moveSequenceSettings = new MoveSequenceSettings(); var encounterSettings = new EncounterSettings(); var iapItemDisplay = new IapItemDisplay(); var iapSettings = new IapSettings(); var equippedBadge = new EquippedBadgeSettings(); var questSettings = new QuestSettings(); var avatarCustomization = new AvatarCustomizationSettings(); var formSettings = new FormSettings(); var genderSettings = new GenderSettings(); var gymBadgeSettings = new GymBadgeGmtSettings(); var weatherAffinities = new WeatherAffinity(); var weatherBonusSettings = new WeatherBonus(); var pokemonScaleSettings = new PokemonScaleSetting(); var typeEffective = new TypeEffectiveSettings(); var camera = new CameraSettings(); var gymLevel = new GymLevelSettings(); foreach (var template in _client.ClientSession.Templates.ItemTemplates) { if (template.PlayerLevel != null) { LevelSettings = template.PlayerLevel; continue; } if (template.PokemonSettings != null) { if (pokemonSettings.ContainsKey(template.PokemonSettings.PokemonId)) { pokemonSettings.Remove(template.PokemonSettings.PokemonId); } pokemonSettings.Add(template.PokemonSettings.PokemonId, template.PokemonSettings); } else if (template.MoveSettings != null) { if (moveSettings.ContainsKey(template.MoveSettings.MovementId)) { moveSettings.Remove(template.MoveSettings.MovementId); } moveSettings.Add(template.MoveSettings.MovementId, template.MoveSettings); } else if (template.BadgeSettings != null) { if (badgeSettings.ContainsKey(template.BadgeSettings.BadgeType)) { badgeSettings.Remove(template.BadgeSettings.BadgeType); } badgeSettings.Add(template.BadgeSettings.BadgeType, template.BadgeSettings); } else if (template.ItemSettings != null) { if (itemSettings.ContainsKey(template.ItemSettings.ItemId)) { itemSettings.Remove(template.ItemSettings.ItemId); } itemSettings.Add(template.ItemSettings.ItemId, template.ItemSettings); } else if (template.EncounterSettings != null) { encounterSettings = template.EncounterSettings; } else if (template.MoveSequenceSettings != null) { moveSequenceSettings = template.MoveSequenceSettings; } else if (template.BattleSettings != null) { battleSettings = template.BattleSettings; } else if (template.IapItemDisplay != null) { iapItemDisplay = template.IapItemDisplay; } else if (template.IapSettings != null) { iapSettings = template.IapSettings; } else if (template.EquippedBadges != null) { equippedBadge = template.EquippedBadges; } else if (template.QuestSettings != null) { questSettings = template.QuestSettings; } else if (template.AvatarCustomization != null) { avatarCustomization = template.AvatarCustomization; } else if (template.FormSettings != null) { formSettings = template.FormSettings; } else if (template.GenderSettings != null) { genderSettings = template.GenderSettings; } else if (template.GymBadgeSettings != null) { gymBadgeSettings = template.GymBadgeSettings; } else if (template.WeatherAffinities != null) { weatherAffinities = template.WeatherAffinities; } else if (template.WeatherBonusSettings != null) { weatherBonusSettings = template.WeatherBonusSettings; } else if (template.PokemonScaleSettings != null) { pokemonScaleSettings = template.PokemonScaleSettings; } else if (template.TypeEffective != null) { typeEffective = template.TypeEffective; } else if (template.Camera != null) { camera = template.Camera; } else if (template.GymLevel != null) { gymLevel = template.GymLevel; } else if (template.PokemonUpgrades != null) { upgradeSettings = template.PokemonUpgrades; } } PokeSettings = pokemonSettings; MoveSettings = moveSettings; BadgeSettings = badgeSettings; ItemSettings = itemSettings; BadgeSettings = badgeSettings; UpgradeSettings = upgradeSettings; GetMoveSequenceSettings = moveSequenceSettings; GetEncounterSettings = encounterSettings; GetIapItemDisplay = iapItemDisplay; GetIapSettings = iapSettings; GetEquippedBadgeSettings = equippedBadge; GetQuestSettings = questSettings; GetAvatarCustomizationSettings = avatarCustomization; GetFormSettings = formSettings; GetGenderSettings = genderSettings; GetGymBadgeGmtSettings = gymBadgeSettings; GetWeatherAffinity = weatherAffinities; GetWeatherBonus = weatherBonusSettings; GetPokemonScaleSetting = pokemonScaleSettings; GetTypeEffectiveSettings = typeEffective; GetCameraSettings = camera; GetGymLevelSettings = gymLevel; return(new MethodResult <Dictionary <PokemonId, PokemonSettings> > { Data = pokemonSettings, Message = "Success", Success = true }); }
internal static void Draw(CameraSettings cameraSettings, GlobalSettings renderingSettings, bool showAdvanced) { GUILayout.BeginVertical(GUIStyles.Skin.box); { Label("Camera", "", true); cameraSettings.ClearFlag = Selection("Clear Flags", cameraSettings.ClearFlag, flag => cameraSettings.ClearFlag = flag); if (showAdvanced) { //changing studio camera's culling mask breaks studio, possibly due to cinemachine GUI.enabled = false; SelectionMask("Culling Mask", cameraSettings.CullingMask, mask => cameraSettings.CullingMask = mask); GUI.enabled = true; } Slider("Near Clipping Plane", cameraSettings.NearClipPlane, 0.01f, 15000f, "N2", ncp => { cameraSettings.NearClipPlane = ncp; }); Slider("Far Clipping Plane", cameraSettings.FarClipPlane, 0.01f, 15000f, "N2", ncp => { cameraSettings.FarClipPlane = ncp; }); Selection("Rendering Path", cameraSettings.RenderingPath, path => cameraSettings.RenderingPath = path); Slider("Field of View", cameraSettings.Fov, FOVMin, FOVMax, "N0", fov => { cameraSettings.Fov = fov; }); Toggle("Occlusion Culling", cameraSettings.OcculsionCulling, false, culling => cameraSettings.OcculsionCulling = culling); Toggle("Allow HDR", cameraSettings.HDR, false, hdr => cameraSettings.HDR = hdr); Toggle("Allow MSAA (Forward Only)", cameraSettings.MSAA, false, msaa => cameraSettings.MSAA = msaa); Toggle("Allow Dynamic Resolution", cameraSettings.DynamicResolution, false, dynamic => cameraSettings.DynamicResolution = dynamic); GUILayout.Space(10); Label("Rendering", "", true); GUILayout.Space(1); Label("Colour Space", QualitySettings.activeColorSpace.ToString()); Label("Quality Level", QualitySettings.names[QualitySettings.GetQualityLevel()]); Text("Pixel Light Count", renderingSettings.PixelLightCount, count => renderingSettings.PixelLightCount = count); Selection("Anisotropic Textures", renderingSettings.AnisotropicFiltering, filtering => renderingSettings.AnisotropicFiltering = filtering); Slider("MSAA Multiplier", renderingSettings.AntiAliasing, 0, 8, aa => renderingSettings.AntiAliasing = aa); Toggle("Realtime Reflection Probes", renderingSettings.RealtimeReflectionProbes, false, realtime => renderingSettings.RealtimeReflectionProbes = realtime); GUILayout.Space(10); Label("Shadows", "", true); GUILayout.Space(1); Selection("Shadowmask Mode", renderingSettings.ShadowmaskModeSetting, mode => renderingSettings.ShadowmaskModeSetting = mode); Selection("Shadows", renderingSettings.ShadowQualitySetting, setting => renderingSettings.ShadowQualitySetting = setting); Selection("Shadow Resolution", renderingSettings.ShadowResolutionSetting, resolution => renderingSettings.ShadowResolutionSetting = resolution); Selection("Shadow Projection", renderingSettings.ShadowProjectionSetting, projection => renderingSettings.ShadowProjectionSetting = projection); Text("Shadow Distance", renderingSettings.ShadowDistance, "N2", distance => renderingSettings.ShadowDistance = distance); Text("Shadow Near Plane Offset", renderingSettings.ShadowNearPlaneOffset, "N2", offset => renderingSettings.ShadowNearPlaneOffset = offset); if (showAdvanced) { Toggle("Use PCSS (Experimental)", renderingSettings.UsePCSS, false, pcss => renderingSettings.UsePCSS = pcss); if (renderingSettings.UsePCSS) { Slider("Blocker Sample Count", PCSSLight.Blocker_SampleCount, 1, 64, count => PCSSLight.Blocker_SampleCount = count); Slider("PCF Sample Count", PCSSLight.PCF_SampleCount, 1, 64, count => PCSSLight.PCF_SampleCount = count); Slider("Softness", PCSSLight.Softness, 0f, 7.5f, "N2", softness => PCSSLight.Softness = softness); Slider("Softness Falloff", PCSSLight.SoftnessFalloff, 0f, 5f, "N2", softnessFalloff => PCSSLight.SoftnessFalloff = softnessFalloff); Slider("Blocker Gradient Bias", PCSSLight.Blocker_GradientBias, 0f, 1f, "N2", bias => PCSSLight.Blocker_GradientBias = bias); Slider("PCF Gradient Bias", PCSSLight.PCF_GradientBias, 0f, 1f, "N2", bias => PCSSLight.PCF_GradientBias = bias); Slider("Max Static Gradient Bias", PCSSLight.MaxStaticGradientBias, 0f, 0.15f, "N2", bias => PCSSLight.MaxStaticGradientBias = bias); Slider("Cascade Blend Distance", PCSSLight.CascadeBlendDistance, 0f, 1f, "N2", distance => PCSSLight.CascadeBlendDistance = distance); } } GUILayout.Space(10); Selection("Language", LocalizationManager.CurrentLanguage, language => LocalizationManager.CurrentLanguage = language); Slider("Font Size", renderingSettings.FontSize, 12, 17, size => renderingSettings.FontSize = size); Slider("Window Width", Inspector.Width, 400, Screen.width / 2, size => Inspector.Width = size); Slider("Window Height", Inspector.Height, 400, Screen.height, size => Inspector.Height = size); GUILayout.Space(10); Toggle("Show Advanced Settings", renderingSettings.ShowAdvancedSettings, false, advanced => renderingSettings.ShowAdvancedSettings = advanced); } GUILayout.EndVertical(); }
void Start() { this.cameraSettings = FindObjectOfType <CameraSettings>(); this.trackableSettings = FindObjectOfType <TrackableSettings>(); }
// Important Notes: // The map is a grid of size width x height // every cell of the grid spawns a Ground Segment prefab unless otherwise specified // // There are 2 grid locations that an object spawns on // Walls have a grid that is [width + 2]x[height + 2] // This allows the walls to seamlessly surround the map as well as take up exactly one tile when placed // Every other object will spawn on the corners of tiles // ie: The ball, goals, etc... will spawn on the vertex of 4 tiles // While walls will spawn completely covering tiles // // Objects that take up multiple tiles such as black holes and goals/holes are placed based on their top left corner // So the black hole if spawned at 16, 16 will delete ground between [8,16]x and [8,16]z 64 total ground segments public BossLevel2() : base() { width = 30; height = 30; cameraSettings = new CameraSettings(new Vector3(0f, 15f, -10f), new Vector3(60f, 0f, 0f), 2.5f, 2.5f); king = new KingCube(15, 15, 0); player = new Player(1, 1); walls = new Wall[] { // new Wall(x1, z1, x2, z2) new Wall(0, 0, 32, 0), // Bottom Wall new Wall(0, 0, 0, 32), // Left Wall new Wall(31, 0, 32, 32), // Right Wall new Wall(0, 31, 32, 32), // Top Wall }; goals = new Goal[] { new Goal(14, 14) }; obstacles = new Obstacle[] { new Hole(0, 4), new Hole(2, 4), new Hole(4, 4), new Hole(6, 4), new Hole(8, 4), new Hole(10, 4), new Hole(12, 4), new Hole(14, 4), new Hole(16, 4), new Hole(18, 4), new Hole(20, 4), new Hole(22, 4), new Hole(24, 4), new Hole(24, 6), new Hole(24, 8), new Hole(24, 10), new Hole(24, 12), new Hole(24, 14), new Hole(24, 16), new Hole(24, 18), new Hole(24, 20), new Hole(24, 22), new Hole(24, 24), }; introDialogue = new Dialogue[] { }; outroDialogue = new Dialogue[] { new Dialogue(5, Dialogue.Speaker.King, "There Is No Way! How Could YOU Beat US!"), new Dialogue(7, Dialogue.Speaker.King, "RUBI K. WE NEED TO TALK!"), new Dialogue(3, Dialogue.Speaker.Rubik, "Y-Yes?"), new Dialogue(7, Dialogue.Speaker.King, "THE GAME HASNT EVEN BEEN COMPLETED YET THEY ALREADY ESCAPED!!!"), new Dialogue(1, Dialogue.Speaker.Rubik, ". . ."), }; failDialogue = new Dialogue[] { new Dialogue(5, Dialogue.Speaker.King, "Try as much as you like. You will never win!"), new Dialogue(5, Dialogue.Speaker.Rubik, "Yes! You Will Never Outsmart Me!!"), new Dialogue(5, Dialogue.Speaker.King, "*Aghem*"), new Dialogue(5, Dialogue.Speaker.Rubik, "U-Us! You Will Never Outsmart US!") }; buildMap(); }
// Use this for initialization void Awake() { camerasettings = cameraPerspective[cameraIndex].GetComponent<CameraSettings>(); char1 = GameObject.FindGameObjectWithTag("Player"); char2 = GameObject.FindGameObjectWithTag("character2"); thirdPersonTransform = cameraPerspective[cameraIndex].transform; myTransform = transform; activeChar = char1; }
public RegisterEvent(FieldDefinition fieldDefinition, CameraSettings cameraSettings) : base() { this.fieldDefinition = fieldDefinition; this.cameraSettings = cameraSettings; }
override public void OnInspectorGUI() { LightingManager2D script = target as LightingManager2D; LightingSettings.Profile newProfile = (LightingSettings.Profile)EditorGUILayout.ObjectField("Profile", script.setProfile, typeof(LightingSettings.Profile), true); if (newProfile != script.setProfile) { script.setProfile = newProfile; script.UpdateProfile(); // LightingMainBuffer2D.Clear(); // Light2D.ForceUpdateAll(); } EditorGUILayout.Space(); int count = script.cameraSettings.Length; count = EditorGUILayout.IntSlider("Camera Count", count, 0, 10); if (count != script.cameraSettings.Length) { System.Array.Resize(ref script.cameraSettings, count); } EditorGUILayout.Space(); for (int id = 0; id < script.cameraSettings.Length; id++) { CameraSettings cameraSetting = script.cameraSettings[id]; cameraFoldout[id] = EditorGUILayout.Foldout(cameraFoldout[id], "Camera " + (id + 1) + " (" + cameraSetting.GetTypeName() + ")"); if (cameraFoldout[id] == false) { EditorGUILayout.Space(); continue; } EditorGUI.indentLevel++; cameraSetting.cameraType = (CameraSettings.CameraType)EditorGUILayout.EnumPopup("Camera Type", cameraSetting.cameraType); if (cameraSetting.cameraType == CameraSettings.CameraType.Custom) { cameraSetting.customCamera = (Camera)EditorGUILayout.ObjectField(cameraSetting.customCamera, typeof(Camera), true); } cameraSetting.bufferID = EditorGUILayout.Popup("Buffer Preset", (int)cameraSetting.bufferID, Lighting2D.Profile.bufferPresets.GetBufferLayers()); cameraSetting.renderMode = (CameraSettings.RenderMode)EditorGUILayout.EnumPopup("Render Mode", cameraSetting.renderMode); if (cameraSetting.renderMode == CameraSettings.RenderMode.Draw) { cameraSetting.renderShader = (CameraSettings.RenderShader)EditorGUILayout.EnumPopup("Render Shader", cameraSetting.renderShader); if (cameraSetting.renderShader == CameraSettings.RenderShader.Custom) { cameraSetting.customMaterial = (Material)EditorGUILayout.ObjectField(cameraSetting.customMaterial, typeof(Material), true); } cameraSetting.renderLayerType = (CameraSettings.RenderLayerType)EditorGUILayout.EnumPopup("Render Layer Type", cameraSetting.renderLayerType); if (cameraSetting.renderLayerType == CameraSettings.RenderLayerType.Custom) { cameraSetting.renderLayerId = EditorGUILayout.LayerField("Render Layer", cameraSetting.renderLayerId); } } cameraMaterialsFoldout[id] = EditorGUILayout.Foldout(cameraMaterialsFoldout[id], "Materials"); if (cameraMaterialsFoldout[id]) { EditorGUI.indentLevel++; CameraMaterials materials = cameraSetting.GetMaterials(); int matCount = materials.materials.Length; matCount = EditorGUILayout.IntField("Count", matCount); if (matCount != materials.materials.Length) { System.Array.Resize(ref materials.materials, matCount); } for (int i = 0; i < materials.materials.Length; i++) { materials.materials[i] = (Material)EditorGUILayout.ObjectField(materials.materials[i], typeof(Material), true); } EditorGUI.indentLevel--; } cameraSetting.id = id; script.cameraSettings[id] = cameraSetting; EditorGUI.indentLevel--; EditorGUILayout.Space(); } /* * * * cameraSetting.renderMode = (CameraSettings.RenderMode)EditorGUILayout.EnumPopup("Render Mode", cameraSetting.renderMode); * * if (cameraSetting.renderMode == CameraSettings.RenderMode.Draw) { * cameraSetting.renderShader = (CameraSettings.RenderShader)EditorGUILayout.EnumPopup("Render Shader", cameraSetting.renderShader); * * if (cameraSetting.renderShader == CameraSettings.RenderShader.Custom) { * cameraSetting.customMaterial = (Material)EditorGUILayout.ObjectField(cameraSetting.customMaterial, typeof(Material), true); * } * }*/ EditorGUILayout.Space(); EditorGUILayout.LabelField("version " + Lighting2D.VERSION_STRING); string buttonName = ""; if (script.version < Lighting2D.VERSION) { buttonName += "Re-Initialize (Outdated)"; GUI.backgroundColor = Color.red; Reinitialize(script); return; } else { buttonName += "Re-Initialize"; } if (GUILayout.Button(buttonName)) { Reinitialize(script); } if (GUI.changed) { Light2D.ForceUpdateAll(); LightingManager2D.ForceUpdate(); if (EditorApplication.isPlaying == false) { EditorUtility.SetDirty(target); EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } } }
public StaticCamera(CameraManager manager, CameraSettings settings) : base(manager, settings) { }
public override void OnRenderUI() { base.OnRenderUI(); if (!Owner.IsAllowScale()) { return; } var renderer = Viewport.CanvasRenderer; Vector2 viewportSize = Viewport.SizeInPixels.ToVector2(); Axes axes = new Axes(false, false, false); if (!Viewport.MouseRelativeMode) { if (!modify_Activated) { axes = GetAxesByMousePosition(); } else { axes = selectedAxes; } } //update cursor if (scaleCursor != null && axes.TrueCount != 0) { ViewportControl.OneFrameChangeCursor = scaleCursor; } Vector3 xOffset, yOffset, zOffset; GetAxisOffsets(out xOffset, out yOffset, out zOffset); Vector3 position = Owner.GetPosition(); Quaternion rotation = GetRotation(); double size = GetSize(); if (size != 0) { //draw axis names { double offsetY = (ArrowPixelSize / 20.0f) / viewportSize.Y; Vector2 screenPosition; if (CameraSettings.ProjectToScreenCoordinates(position + xOffset, out screenPosition)) { Vector2 pos = new Vector2(screenPosition.X, screenPosition.Y - offsetY); ColorValue color = axes.x ? new ColorValue(1, 1, 0) : new ColorValue(1, 0, 0); AddTextWithShadow(renderer, "x", pos, EHorizontalAlignment.Center, EVerticalAlignment.Bottom, color, 1); } if (CameraSettings.ProjectToScreenCoordinates(position + yOffset, out screenPosition)) { Vector2 pos = new Vector2(screenPosition.X, screenPosition.Y - offsetY); ColorValue color = axes.y ? new ColorValue(1, 1, 0) : new ColorValue(0, 1, 0); AddTextWithShadow(renderer, "y", pos, EHorizontalAlignment.Center, EVerticalAlignment.Bottom, color, 1); } if (CameraSettings.ProjectToScreenCoordinates(position + zOffset, out screenPosition)) { Vector2 pos = new Vector2(screenPosition.X, screenPosition.Y - offsetY); ColorValue color = axes.z ? new ColorValue(1, 1, 0) : new ColorValue(0, 0, 1); AddTextWithShadow(renderer, "z", pos, EHorizontalAlignment.Center, EVerticalAlignment.Bottom, color, 1); } } //draw help text if (modify_Activated && !string.IsNullOrEmpty(helpText)) { Vector2 screenPosition; if (CameraSettings.ProjectToScreenCoordinates(Owner.GetPosition(), out screenPosition)) { double offsetY = (ArrowPixelSize / viewportSize.Y) * 1.2f; Vector2 pos = new Vector2(screenPosition.X, screenPosition.Y - offsetY); AddTextWithShadow(renderer, helpText, pos, EHorizontalAlignment.Center, EVerticalAlignment.Bottom, new ColorValue(1, 1, 0), 2); } } } }
void Start () { cameraSettings = cameraTargets[cameraIndex].GetComponent<CameraSettings>(); }
public async UniTask <byte[]> CaptureFulllevel(bool isTransparent, RectInt?rect = null) { if (isTransparent) { Controller.obj.levelController.controllerTilemap.backgroundTint.gameObject.SetActive(false); } //Camera[] cams = Camera.allCameras.OrderBy(c => c.depth).ToArray(); int width = LevelEditorData.MaxWidth; int height = LevelEditorData.MaxHeight; int cellSize = LevelEditorData.Level.CellSize; int screenshotWidth = Mathf.CeilToInt(width / (float)cellSize); int screenshotHeight = Mathf.CeilToInt(height / (float)cellSize); var cellSizeInUnits = cellSize / (float)LevelEditorData.Level.PixelsPerUnit; Dictionary <Camera, CameraSettings> camSettings = new Dictionary <Camera, CameraSettings>(); EditorCam ec = Controller.obj?.levelController?.editor?.cam; ec.enabled = false; List <Camera> cameras = new List <Camera>(); // Add main camera { Camera cam = Camera.main; camSettings[cam] = CameraSettings.Current(cam); cam.transform.position = new Vector3((LevelEditorData.MaxWidth) * cellSizeInUnits / 2f, -(LevelEditorData.MaxHeight) * cellSizeInUnits / 2f, cam.transform.position.z); cam.orthographicSize = (LevelEditorData.MaxHeight * cellSizeInUnits / 2f); cam.rect = new Rect(0, 0, 1, 1); cameras.Add(cam); } if (LevelEditorData.Level?.IsometricData != null) { // Add isometric camera Camera cam = ec.camera3D; camSettings[cam] = CameraSettings.Current(cam); // Update 3D camera float scl = 1f; Quaternion rot3D = LevelEditorData.Level.IsometricData.ViewAngle; cam.transform.rotation = rot3D; Vector3 v = rot3D * Vector3.back; float w = LevelEditorData.Level.IsometricData.TilesWidth * cellSizeInUnits; float h = (LevelEditorData.Level.IsometricData.TilesHeight) * cellSizeInUnits; float colYDisplacement = LevelEditorData.Level.IsometricData.CalculateYDisplacement(); float colXDisplacement = LevelEditorData.Level.IsometricData.CalculateXDisplacement(); var pos = new Vector3((LevelEditorData.MaxWidth) * cellSizeInUnits / 2f, -(LevelEditorData.MaxHeight) * cellSizeInUnits / 2f, -10f); cam.transform.position = v * 300 + rot3D * ((pos - new Vector3((w - colXDisplacement) / 2f, -(h - colYDisplacement) / 2f, 0f)) / scl); // Move back 300 units cam.orthographicSize = Camera.main.orthographicSize / scl; cam.rect = new Rect(0, 0, 1, 1); cam.orthographic = true; cam.gameObject.SetActive(true); cameras.Add(cam); await UniTask.WaitForEndOfFrame(); // Update all object positions & rotations according to this new camera pos var objects = Controller.obj.levelController.Objects; foreach (var obj in objects) { obj.UpdatePosition3D(); } } await UniTask.WaitForEndOfFrame(); byte[] screenshotBytes = null; var lScreenshot = zzTransparencyCapture.CaptureScreenshot(width * cellSize, height * cellSize, isTransparent, camera: cameras.ToArray()); foreach (var cam in cameras) { camSettings[cam].Apply(cam); } ec.enabled = true; try { if (rect != null) { lScreenshot = lScreenshot.Crop(rect.Value, true); } screenshotBytes = lScreenshot.EncodeToPNG(); } finally { Object.DestroyImmediate(lScreenshot); } if (isTransparent) { Controller.obj.levelController.controllerTilemap.backgroundTint.gameObject.SetActive(true); } Debug.Log("Screenshot saved."); return(screenshotBytes); }
public SetupDialogForm(CameraSettings settings) { Settings = settings; InitializeComponent(); InitUI(); }
/// <summary> /// Constructor. Creates a new instance of CameraSettings to contain all settings values. /// </summary> public ZEDCameraSettings() { settings_ = new CameraSettings(); }
/////////////// Axis GetAxisByMousePosition(out Vector2 screenLinePointInPixels, out Radian screenLineAngle) { screenLinePointInPixels = Vector2.Zero; screenLineAngle = 0; Vector2 viewportSize = Owner.ViewportControl.Viewport.SizeInPixels.ToVector2(); Trace.Assert(Owner.Objects.Count != 0); Vector3 position = Owner.GetPosition(); double radius = GetSize(); if (radius == 0) { return(Axis.None); } const double step = MathEx.PI / 64; double innerRadius = radius * .75f; double cameraDistance = GetCameraDistance(position); Vector3 oldPos = Vector3.Zero; Quaternion startRotation = GetStartObjectsRotation(); //X for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position + startRotation * (new Vector3(0, Math.Sin(angle), Math.Cos(angle)) * innerRadius); if (angle != 0 && GetCameraDistance(pos) <= cameraDistance && IsMouseNearLine(oldPos, pos, out screenLinePointInPixels, out screenLineAngle, out _)) { return(Axis.X); } oldPos = pos; } //Y for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position + startRotation * (new Vector3(Math.Sin(angle), 0, Math.Cos(angle)) * innerRadius); if (angle != 0 && GetCameraDistance(pos) <= cameraDistance && IsMouseNearLine(oldPos, pos, out screenLinePointInPixels, out screenLineAngle, out _)) { return(Axis.Y); } oldPos = pos; } //Z for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position + startRotation * (new Vector3(Math.Sin(angle), Math.Cos(angle), 0) * innerRadius); if (angle != 0 && (GetCameraDistance(pos) <= cameraDistance || Owner.SceneMode2D) && IsMouseNearLine(oldPos, pos, out screenLinePointInPixels, out screenLineAngle, out _)) { return(Axis.Z); } oldPos = pos; } Vector2 mouseInPixels = Owner.viewportControl.Viewport.MousePosition * viewportSize; Vector2 screenPosition; if (CameraSettings.ProjectToScreenCoordinates(position, out screenPosition)) { Vector2 screenPositionInPixels = screenPosition * viewportSize; double mouseDistanceInPixels = (mouseInPixels - screenPositionInPixels).Length(); //Radius if (Math.Abs(mouseDistanceInPixels - ArrowPixelSize) < SelectNearPixels && !Owner.SceneMode2D) { Vector2 diffPixels = mouseInPixels - screenPositionInPixels; Vector2 direction = diffPixels.GetNormalize(); screenLinePointInPixels = (screenPositionInPixels + direction * ArrowPixelSize); screenLineAngle = Math.Atan2(diffPixels.Y, diffPixels.X) + MathEx.PI / 2; return(Axis.Radius); } //Inner circle if (mouseDistanceInPixels < (ArrowPixelSize) * .75f + SelectNearPixels) { return(Axis.InnerCircle); } } return(Axis.None); }
protected virtual void Start() { mCamSettings = FindObjectOfType <CameraSettings>(); mTrackableSettings = FindObjectOfType <TrackableSettings>(); mMenuAnim = FindObjectOfType <MenuAnimator>(); }
public void Render( ScriptableRenderContext context, Camera camera, CameraBufferSettings bufferSettings, bool useDynamicBatching, bool useGPUInstancing, bool useLightsPerObject, ShadowSettings shadowSettings, PostFXSettings postFXSettings, int colorLUTResolution ) { this.context = context; this.camera = camera; var crpCamera = camera.GetComponent <CustomRenderPipelineCamera>(); CameraSettings cameraSettings = crpCamera ? crpCamera.Settings : defaultCameraSettings; if (camera.cameraType == CameraType.Reflection) { useColorTexture = bufferSettings.copyColorReflection; useDepthTexture = bufferSettings.copyDepthReflection; } else { useColorTexture = bufferSettings.copyColor && cameraSettings.copyColor; useDepthTexture = bufferSettings.copyDepth && cameraSettings.copyDepth; } if (cameraSettings.overridePostFX) { postFXSettings = cameraSettings.postFXSettings; } float renderScale = cameraSettings.GetRenderScale(bufferSettings.renderScale); useScaledRendering = renderScale <0.99f || renderScale> 1.01f; PrepareBuffer(); PrepareForSceneWindow(); if (!Cull(shadowSettings.maxDistance)) { return; } useHDR = bufferSettings.allowHDR && camera.allowHDR; if (useScaledRendering) { renderScale = Mathf.Clamp(renderScale, renderScaleMin, renderScaleMax); bufferSize.x = (int)(camera.pixelWidth * renderScale); bufferSize.y = (int)(camera.pixelHeight * renderScale); } else { bufferSize.x = camera.pixelWidth; bufferSize.y = camera.pixelHeight; } buffer.BeginSample(SampleName); buffer.SetGlobalVector(bufferSizeId, new Vector4( 1f / bufferSize.x, 1f / bufferSize.y, bufferSize.x, bufferSize.y )); ExecuteBuffer(); lighting.Setup( context, cullingResults, shadowSettings, useLightsPerObject, cameraSettings.maskLights ? cameraSettings.renderingLayerMask : -1 ); bufferSettings.fxaa.enabled &= cameraSettings.allowFXAA; postFXStack.Setup( context, camera, bufferSize, postFXSettings, cameraSettings.keepAlpha, useHDR, colorLUTResolution, cameraSettings.finalBlendMode, bufferSettings.bicubicRescaling, bufferSettings.fxaa ); buffer.EndSample(SampleName); Setup(); DrawVisibleGeometry( useDynamicBatching, useGPUInstancing, useLightsPerObject, cameraSettings.renderingLayerMask ); DrawUnsupportedShaders(); DrawGizmosBeforeFX(); if (postFXStack.IsActive) { postFXStack.Render(colorAttachmentId); } else if (useIntermediateBuffer) { DrawFinal(cameraSettings.finalBlendMode); ExecuteBuffer(); } DrawGizmosAfterFX(); Cleanup(); Submit(); }
public override void OnRender() { base.OnRender(); if (!Owner.IsAllowRotate()) { return; } ColorValue yellow = new ColorValue(1, 1, 0); ColorValue red = new ColorValue(1, 0, 0); ColorValue green = new ColorValue(0, 1, 0); ColorValue blue = new ColorValue(0, 0, 1); ColorValue gray = new ColorValue(.66f, .66f, .66f); ColorValue darkGray = new ColorValue(.33f, .33f, .33f); ColorValue shadowColor = new ColorValue(0, 0, 0, ProjectSettings.Get.TransformToolShadowIntensity); Axis axis = Axis.None; if (!Viewport.MouseRelativeMode) { if (!modify_Activated) { Vector2 dummy1; Radian dummy2; axis = GetAxisByMousePosition(out dummy1, out dummy2); } else { axis = selectedAxis; } } Vector3 position; if (!modify_Activated) { position = Owner.GetPosition(); } else { position = modifyPosition; } double lineThickness = GetLineWorldThickness(position); double radius = GetSize(); if (radius == 0) { return; } //DebugGeometry.SetSpecialDepthSettings( false, true ); const double step = MathEx.PI / 64; double innerRadius = radius * .75f; double cameraDistance = GetCameraDistance(position); Vector3 cameraRight = Vector3.Cross(CameraSettings.Direction, CameraSettings.Up); Vector3 oldPos = Vector3.Zero; Quaternion startRotation = GetStartObjectsRotation(); for (int nDrawStep = 0; nDrawStep < 5; nDrawStep++) { bool drawShadows = nDrawStep <= 3; if (drawShadows && ProjectSettings.Get.TransformToolShadowIntensity == 0) { continue; } var drawShadowsFactor = 0.0; if (drawShadows) { drawShadowsFactor = ((double)nDrawStep + 1.0) / 4.0; } if (drawShadows) { DebugGeometry.SetColor(shadowColor * new ColorValue(1, 1, 1, 0.25), false); //, true ); } //Fill inner circle if (axis == Axis.InnerCircle && !drawShadows) { if (!drawShadows) { DebugGeometry.SetColor(new ColorValue(1, 1, 0, .4f), false); //, true ); } //DebugGeometry.Color = new ColorValue( .2f, .2f, .2f, .33f ); List <Vector3> vertices = new List <Vector3>(); for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position; pos += cameraRight * Math.Cos(angle) * innerRadius; pos += CameraSettings.Up * Math.Sin(angle) * innerRadius; if (angle != 0) { int verticesCount = vertices.Count; vertices.Add(position); vertices.Add(oldPos); vertices.Add(pos); } oldPos = pos; } DebugGeometry.AddTriangles(vertices, Matrix4.Identity, false, false); } //!!!!тут? //render axes of objects if (!drawShadows && Owner.Objects.Count <= 30) { foreach (TransformToolObject gizmoObject in Owner.Objects) { var size = radius / 3; double alpha = 1; // 0.333; double thickness = GetLineWorldThickness(gizmoObject.Position); Matrix4 transform = new Matrix4(gizmoObject.Rotation.ToMatrix3() * Matrix3.FromScale(new Vector3(size, size, size)), gizmoObject.Position); var headHeight = size / 4; DebugGeometry.SetColor(new ColorValue(1, 0, 0, alpha), false); //, true ); DebugGeometry.AddArrow(transform * Vector3.Zero, transform * Vector3.XAxis, headHeight, 0, true, thickness); DebugGeometry.SetColor(new ColorValue(0, 1, 0, alpha), false); //, true ); DebugGeometry.AddArrow(transform * Vector3.Zero, transform * Vector3.YAxis, headHeight, 0, true, thickness); DebugGeometry.SetColor(new ColorValue(0, 0, 1, alpha), false); //, true ); DebugGeometry.AddArrow(transform * Vector3.Zero, transform * Vector3.ZAxis, headHeight, 0, true, thickness); } } //Inner circle { List <Vector3> points = new List <Vector3>(64); for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position; pos += cameraRight * Math.Cos(angle) * innerRadius; pos += CameraSettings.Up * Math.Sin(angle) * innerRadius; points.Add(pos); } if (!drawShadows) { DebugGeometry.SetColor(darkGray, false); //, true ); } AddPolygonalChain(points.ToArray(), lineThickness, drawShadowsFactor); } //if( !drawShadows ) // DebugGeometry.Color = darkGray; //for( double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step ) //{ // Vec3 pos = position; // pos += cameraRight * Math.Cos( angle ) * innerRadius; // pos += camera.Up * Math.Sin( angle ) * innerRadius; // if( angle != 0 ) // AddLine( oldPos, pos, lineThickness, drawShadows ); // oldPos = pos; //} //Radius if (!Owner.SceneMode2D) { List <Vector3> points = new List <Vector3>(64); for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position; pos += cameraRight * Math.Cos(angle) * radius; pos += CameraSettings.Up * Math.Sin(angle) * radius; points.Add(pos); } if (!drawShadows) { DebugGeometry.SetColor((axis == Axis.Radius) ? yellow : gray, false); //, true ); } AddPolygonalChain(points.ToArray(), lineThickness, drawShadowsFactor); } //if( !drawShadows ) // DebugGeometry.Color = ( axis == Axis.Radius ) ? yellow : gray; //for( double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step ) //{ // Vec3 pos = position; // pos += cameraRight * Math.Cos( angle ) * radius; // pos += camera.Up * Math.Sin( angle ) * radius; // if( angle != 0 ) // AddLine( oldPos, pos, lineThickness, drawShadows ); // oldPos = pos; //} //X { List <Vector3> points = new List <Vector3>(64); List <bool> skipLines = new List <bool>(64); for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position + startRotation * (new Vector3(0, Math.Sin(angle), Math.Cos(angle)) * innerRadius); points.Add(pos); bool skip = GetCameraDistance(pos) > cameraDistance; skipLines.Add(skip); //if( angle != 0 && GetCameraDistance( pos ) <= cameraDistance ) // points.Add( pos ); } if (!drawShadows) { DebugGeometry.SetColor((axis == Axis.X) ? yellow : red, false); //, true ); } List <Vector3> newPoints = new List <Vector3>(64); for (int n = 0; n < points.Count; n++) { if (!skipLines[n]) { newPoints.Add(points[n]); } else { if (newPoints.Count != 0) { AddPolygonalChain(newPoints.ToArray(), lineThickness, drawShadowsFactor); newPoints.Clear(); } } } if (newPoints.Count != 0) { AddPolygonalChain(newPoints.ToArray(), lineThickness, drawShadowsFactor); newPoints.Clear(); } } //for( double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step ) //{ // Vec3 pos = position + startRotation * ( new Vec3( 0, Math.Sin( angle ), // Math.Cos( angle ) ) * innerRadius ); // if( angle != 0 && GetCameraDistance( pos ) <= cameraDistance ) // AddLine( oldPos, pos, lineThickness, drawShadows ); // oldPos = pos; //} //Y { List <Vector3> points = new List <Vector3>(64); List <bool> skipLines = new List <bool>(64); for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position + startRotation * (new Vector3(Math.Sin(angle), 0, Math.Cos(angle)) * innerRadius); points.Add(pos); bool skip = GetCameraDistance(pos) > cameraDistance; skipLines.Add(skip); //if( angle != 0 && GetCameraDistance( pos ) <= cameraDistance ) // points.Add( pos ); } if (!drawShadows) { DebugGeometry.SetColor((axis == Axis.Y) ? yellow : green, false); //, true ); } List <Vector3> newPoints = new List <Vector3>(64); for (int n = 0; n < points.Count; n++) { if (!skipLines[n]) { newPoints.Add(points[n]); } else { if (newPoints.Count != 0) { AddPolygonalChain(newPoints.ToArray(), lineThickness, drawShadowsFactor); newPoints.Clear(); } } } if (newPoints.Count != 0) { AddPolygonalChain(newPoints.ToArray(), lineThickness, drawShadowsFactor); newPoints.Clear(); } } //if( !drawShadows ) // DebugGeometry.Color = ( axis == Axis.Y ) ? yellow : green; //for( double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step ) //{ // Vec3 pos = position + startRotation * ( new Vec3( Math.Sin( angle ), 0, // Math.Cos( angle ) ) * innerRadius ); // if( angle != 0 && GetCameraDistance( pos ) <= cameraDistance ) // AddLine( oldPos, pos, lineThickness, drawShadows ); // oldPos = pos; //} //Z { List <Vector3> points = new List <Vector3>(64); List <bool> skipLines = new List <bool>(64); for (double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step) { Vector3 pos = position + startRotation * (new Vector3(Math.Sin(angle), Math.Cos(angle), 0) * innerRadius); points.Add(pos); bool skip = GetCameraDistance(pos) > cameraDistance; if (Owner.SceneMode2D) { skip = false; } skipLines.Add(skip); //if( angle != 0 && GetCameraDistance( pos ) <= cameraDistance ) // points.Add( pos ); } if (!drawShadows) { DebugGeometry.SetColor((axis == Axis.Z) ? yellow : blue, false); //, true ); } List <Vector3> newPoints = new List <Vector3>(64); for (int n = 0; n < points.Count; n++) { if (!skipLines[n]) { newPoints.Add(points[n]); } else { if (newPoints.Count != 0) { AddPolygonalChain(newPoints.ToArray(), lineThickness, drawShadowsFactor); newPoints.Clear(); } } } if (newPoints.Count != 0) { AddPolygonalChain(newPoints.ToArray(), lineThickness, drawShadowsFactor); newPoints.Clear(); } } //if( !drawShadows ) // DebugGeometry.Color = ( axis == Axis.Z ) ? yellow : blue; //for( double angle = 0; angle <= MathEx.PI * 2 + step * .5f; angle += step ) //{ // Vec3 pos = position + startRotation * ( new Vec3( Math.Sin( angle ), // Math.Cos( angle ), 0 ) * innerRadius ); // if( angle != 0 && GetCameraDistance( pos ) <= cameraDistance ) // AddLine( oldPos, pos, lineThickness, drawShadows ); // oldPos = pos; //} //Arrows if (axis != Axis.None && axis != Axis.InnerCircle) { Plane plane = new Plane(); switch (axis) { case Axis.X: plane = Plane.FromPointAndNormal(position, GetStartObjectsRotation() * Vector3.XAxis); break; case Axis.Y: plane = Plane.FromPointAndNormal(position, GetStartObjectsRotation() * Vector3.YAxis); break; case Axis.Z: plane = Plane.FromPointAndNormal(position, GetStartObjectsRotation() * Vector3.ZAxis); break; case Axis.Radius: plane = Plane.FromPointAndNormal(position, CameraSettings.Direction); break; } Vector2 mouse; if (modify_Activated || initialObjectsTransform != null) { mouse = mouseStartPosition; } else { mouse = Viewport.MousePosition; } Ray ray = CameraSettings.GetRayByScreenCoordinates(mouse); Vector3 planeIntersection; if (plane.Intersects(ray, out planeIntersection)) { Vector3 direction = (planeIntersection - position).GetNormalize(); Vector3 arrowCenter; if (axis == Axis.Radius) { arrowCenter = position + direction * radius; } else { arrowCenter = position + direction * innerRadius; } double arrowLength = radius * .3f; Vector3 tangent = Vector3.Cross(direction, plane.Normal); Vector3 arrowPosition1 = arrowCenter + tangent * arrowLength; Vector3 arrowPosition2 = arrowCenter - tangent * arrowLength; if (!drawShadows) { DebugGeometry.SetColor(yellow, false); //, true ); } { Vector3 direction1 = (arrowPosition1 - arrowCenter).GetNormalize(); AddCone( arrowCenter + direction1 * arrowLength / 2, arrowPosition1, arrowLength / 8, lineThickness, drawShadowsFactor); } { Vector3 direction2 = (arrowPosition2 - arrowCenter).GetNormalize(); AddCone( arrowCenter + direction2 * arrowLength / 2, arrowPosition2, arrowLength / 8, lineThickness, drawShadowsFactor); } } } } //DebugGeometry.RestoreDefaultDepthSettings(); }
void UpdateCamera(CameraSettings settings) { UpdateCamera(mainCamera, settings); }
internal GameObjects(CameraSettings parentSetting) { this.parentSetting = parentSetting; }
void UpdateCamera(Camera camera, CameraSettings settings) { camera.transform.parent = settings.parentTransform; camera.transform.localPosition = settings.position; camera.transform.localEulerAngles = settings.rotation; camera.orthographic = settings.othographic; camera.orthographicSize = settings.orthographicSize; camera.nearClipPlane = settings.nearClipPlane; }
public Level1() : base() { width = 27; height = 30; cameraSettings = new CameraSettings(new Vector3(0f, 15f, -10f), new Vector3(60f, 0f, 0f), 2.5f, 2.5f); // (0, 15, -10) player = new Player(1, 1); walls = new Wall[] { // new Wall(x1, z1, x2, z2) // 1:start from x > 2:start from z ^ // 3: > 4:^ new Wall(0, 0, 28, 0), // Bottom Wall new Wall(0, 0, 0, 31), // Left Wall new Wall(27, 0, 28, 31), // Right Wall // new Wall(0, 30, 28, 31),// Top Wall new Wall(5, 0, 6, 10), // Internal Wall: start new Wall(0, 15, 12, 16), new Wall(12, 8, 13, 16), new Wall(18, 5, 19, 20), new Wall(10, 20, 19, 21), new Wall(0, 25, 23, 26), }; wallsBouncy = new WallBouncy[] { new WallBouncy(0, 30, 27, 31),//top wall new WallBouncy(5, 5, 18, 6), new WallBouncy(22, 5, 23, 26), }; goals = new Goal[] { new Goal(1, 27), }; obstacles = new Obstacle[] { new Hole(8, 6), new Hole(23, 6), new Hole(23, 15), new Hole(23, 22), new Hole(21, 26), }; introDialogue = new Dialogue[] { new Dialogue(70, Dialogue.Speaker.Rubik, "Welcome To your doom!"), new Dialogue(50, Dialogue.Speaker.Rubik, "We're going to have some fun you and I!"), new Dialogue(50, Dialogue.Speaker.Rubik, "Because now the walls turn against you! You thought you could find solace against these edges, but now they will push you to your sanity’s edge! HAHAHA!"), }; outroDialogue = new Dialogue[] { new Dialogue(50, Dialogue.Speaker.Rubik, "I have more planned for you, you just wait and see. You'll crack like Humpty Dumpty did in our maze!"), }; failDialogue = new Dialogue[] { new Dialogue(50, Dialogue.Speaker.King, "Hey Rubik, I have a great new idea! You ever try to fit a round peg in a square hole?"), new Dialogue(50, Dialogue.Speaker.Rubik, "I think I know where you're pointing to! I gotta say, it sounds FITTING!"), new Dialogue(50, Dialogue.Speaker.King, "Well, thank cube very much! Now get to it!"), }; buildMap(); }
public void Render( ScriptableRenderContext context, Camera camera, CameraBufferSettings bufferSettings, bool useDynamicBatching, bool useGPUInstancing, bool useLightsPerObject, ShadowSettings shadowSettings, PostFXSettings postFXSettings, int colorLUTResolution ) { this.context = context; this.camera = camera; var crpCamera = camera.GetComponent <CustomRenderPipelineCamera>(); CameraSettings cameraSettings = crpCamera ? crpCamera.Settings : defaultCameraSettings; if (camera.cameraType == CameraType.Reflection) { useColorTexture = bufferSettings.copyColorReflection; useDepthTexture = bufferSettings.copyDepthReflection; } else { useColorTexture = bufferSettings.copyColor && cameraSettings.copyColor; useDepthTexture = bufferSettings.copyDepth && cameraSettings.copyDepth; } if (cameraSettings.overridePostFX) { postFXSettings = cameraSettings.postFXSettings; } PrepareBuffer(); PrepareForSceneWindow(); if (!Cull(shadowSettings.maxDistance)) { return; } useHDR = bufferSettings.allowHDR && camera.allowHDR; buffer.BeginSample(SampleName); ExecuteBuffer(); lighting.Setup( context, cullingResults, shadowSettings, useLightsPerObject, cameraSettings.maskLights ? cameraSettings.renderingLayerMask : -1 ); postFXStack.Setup( context, camera, postFXSettings, useHDR, colorLUTResolution, cameraSettings.finalBlendMode ); buffer.EndSample(SampleName); Setup(); DrawVisibleGeometry( useDynamicBatching, useGPUInstancing, useLightsPerObject, cameraSettings.renderingLayerMask ); DrawUnsupportedShaders(); DrawGizmosBeforeFX(); if (postFXStack.IsActive) { postFXStack.Render(colorAttachmentId); } else if (useIntermediateBuffer) { DrawFinal(cameraSettings.finalBlendMode); ExecuteBuffer(); } DrawGizmosAfterFX(); Cleanup(); Submit(); }