void Update() { if (bPauseOptions) { pauseTime -= Time.deltaTime; if (pauseTime <= 0) { UnpauseOptions(); } } // Temp: Update Camera display / aspect ratio & virtual joystick if (Input.GetKeyUp(KeyCode.R) || contSupp.ControllerMenuLeft("up")) { ConfigureParameters(); fixedJoy.JoystickPosition(); } }
void Update() { // Temp: Update Camera display / aspect ratio if (Input.GetKeyUp(KeyCode.R) || //Input.GetKeyUp(KeyCode.JoystickButton6)) contSupp.ControllerMenuLeft("up")) { aspectUtil.Awake(); ConfigureParameters(); } if (Input.GetKeyDown(KeyCode.T)) { Debug.Log("W:" + Screen.width); Debug.Log("H:" + Screen.height); //Debug.Log("CW:" + showdownCamera.pixelWidth); //Debug.Log("R:" + (float)(Screen.width/showdownCamera.pixelWidth)); } // Advance active dialogues if ((bDialogueActive && Input.GetKeyDown(KeyCode.Space)) || (bDialogueActive && Input.GetMouseButtonDown(0)) || (bDialogueActive && touches.bAaction)) { currentLine++; } // End of dialogue => reset everything if (currentLine >= dialogueLines.Length) { dbox.SetActive(false); bDialogueActive = false; currentLine = 0; } // Set current text dText.text = dialogueLines[currentLine]; }
private void HandleInputs() { // Zoom Out if (Input.GetKey(KeyCode.I) || contSupp.ControllerTriggerRight() > 0 || tConts.bYaction) { if (scale > 0.00000001f) { scale *= .99f; } // Jump to max zoomed-out level else { scale = 75000f; } } // Zoom In else if (Input.GetKey(KeyCode.K) || contSupp.ControllerTriggerLeft() > 0 || tConts.bXaction) { if (scale < 75000f) { scale *= 1.01f; } // Jump to max zoomed-in level else { scale = 0.00000001f; smoothScale = Mathf.Lerp(scale, scale, 0.0333f); pos.x = -0.7500075f; pos.y = 0.003150068f; mat.SetVector("_Area", new Vector4(pos.x, pos.y, scale, scale)); } } // Rotate Left if (Input.GetKey(KeyCode.J) || contSupp.ControllerBumperLeft("hold") || tConts.bAaction) { angle -= 0.01f; } // Rotate Right else if (Input.GetKey(KeyCode.L) || contSupp.ControllerBumperRight("hold") || tConts.bBaction) { angle += 0.01f; } Vector2 dir = new Vector2(0.01f * scale, 0); float s = Mathf.Sin(angle); float c = Mathf.Cos(angle); dir = new Vector2(dir.x * c, dir.x * s); // Move Left if (Input.GetKey(KeyCode.A) || contSupp.ControllerLeftJoystickHorizontal() < 0 || contSupp.ControllerDirectionalPadHorizontal() < 0 || tConts.bLeft) { pos -= dir; } // Move Right else if (Input.GetKey(KeyCode.D) || contSupp.ControllerLeftJoystickHorizontal() > 0 || contSupp.ControllerDirectionalPadHorizontal() > 0 || tConts.bRight) { pos += dir; } dir = new Vector2(-dir.y, dir.x); // Move Down if (Input.GetKey(KeyCode.S) || contSupp.ControllerLeftJoystickVertical() < 0 || contSupp.ControllerDirectionalPadVertical() < 0 || tConts.bDown) { pos -= dir; } // Move Up else if (Input.GetKey(KeyCode.W) || contSupp.ControllerLeftJoystickVertical() > 0 || contSupp.ControllerDirectionalPadVertical() > 0 || tConts.bUp) { pos += dir; } // Cycle Colors if (Input.GetKey(KeyCode.U) || contSupp.ControllerButtonPadTop("hold") || tConts.bUpLeft) { if (color > 0) { color -= 0.01f; } } else if (Input.GetKey(KeyCode.O) || contSupp.ControllerButtonPadLeft("hold") || tConts.bUpRight) { if (color < 1) { color += 0.01f; } } // Kaleidoscope if (Input.GetKey(KeyCode.E) || contSupp.ControllerButtonPadRight("hold") || tConts.bDownLeft) { if (symmetry > 0) { symmetry -= 0.1f; } else if (symmetry < 0) { symmetry = 0; } } else if (Input.GetKey(KeyCode.Q) || contSupp.ControllerButtonPadBottom("hold") || tConts.bDownRight) { if (symmetry < 1) { symmetry += 0.1f; } } if (Input.GetKey(KeyCode.R) || contSupp.ControllerMenuLeft("hold") || Input.touchCount == 3) { ResetShader(); } }
void Update() { if (bPauseDialogue) { pauseTime -= Time.deltaTime; if (pauseTime < 0) { UnpauseDialogue(); } } // Advance active dialogues if (bDialogueActive && !bPauseDialogue && !pause.bPausing && !pause.bPauseActive && (touches.bAaction || Input.GetButtonDown("Action") || Input.GetButtonDown("BAction") || contSupp.ControllerButtonPadBottom("down") || contSupp.ControllerButtonPadRight("down") || (Input.GetButtonDown("DialogueAction") && !uMan.bControlsActive))) { touches.Vibrate(); if (!bTypewriting) { if (currentLine < dialogueLines.Length) { currentLine++; // 05/10/2019 DC -- Avoids the GWC double tap bug if (!oMan.bOptionsActive) { touches.bAaction = false; } } if (bDialogueActive && !oMan.bOptionsActive && currentLine <= dialogueLines.Length - 1) { StartCoroutine(TypewriteText()); } } else { delayForTypewriting = delayForTypewriting / 10f; } } // Show Options if present and w/ the last dialogue prompt; otherwise, reset the dialogue if (bDialogueActive && oMan.bDiaToOpts && !bTypewriting && !oMan.bOptionsActive && currentLine >= dialogueLines.Length - 1) { oMan.ShowOptions(); } else if (!oMan.bOptionsActive && currentLine >= dialogueLines.Length) { ResetDialogue(); } // Temp: Update Camera display / aspect ratio & virtual joystick if (Input.GetKeyUp(KeyCode.R) || contSupp.ControllerMenuLeft("up")) { ConfigureParameters(); fixedJoy.JoystickPosition(); uMan.SetMenus(); } //Check sizing stuff //if (Input.GetKeyDown(KeyCode.T)) //{ // Debug.Log("Cam rect:" + mainCamera.GetComponent<Camera>().rect); // Debug.Log("Cam width:" + mainCamera.GetComponent<Camera>().rect.width); // Debug.Log("Cam height:" + mainCamera.GetComponent<Camera>().rect.height); //} }
void Update() { // Temp: Update Camera display / aspect ratio if (Input.GetKeyUp(KeyCode.R) || contSupp.ControllerMenuLeft("up")) { aspectUtil.Awake(); } if (scene.name == "GuessWhoColluded") { // Camera stays w/in the bounds set here while following the player minCamX = 1.053f * myCam.orthographicSize - 0.9398f; minCamY = 0.6316f * myCam.orthographicSize - 6.564f; maxCamX = -1.053f * myCam.orthographicSize + 10.94f; maxCamY = -0.6316f * myCam.orthographicSize + 0.5639f; posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime); posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime); transform.position = new Vector3( Mathf.Clamp(posX, minCamX, maxCamX), Mathf.Clamp(posY, minCamY, maxCamY), depth); } else if (scene.name == "Minesweeper") { posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime); posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime); transform.position = new Vector3(posX, posY, depth); } else if (myCam.GetComponent <CameraSlider>()) { if (!myCam.GetComponent <CameraSlider>().bIsSliding) { // Camera follows the player with a slight delay posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime); posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime); transform.position = new Vector3(posX, posY, depth); // Camera bounds per area // Areas listed alphabetically // Note: Float multiplier is macro-position away from bottom left (origin) // DC 09/25/2017 -- TODO: Possible performance upgrade based on most visited at the top if (currentCoords == AnandaCoords.BatteryNE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 3.0f), (maxCamPos.x + 5.12f * 3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 0.0f), (maxCamPos.y + 5.12f * 0.0f)), depth); } else if (currentCoords == AnandaCoords.BatteryNW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 2.0f), (maxCamPos.x + 5.12f * 2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 0.0f), (maxCamPos.y + 5.12f * 0.0f)), depth); } else if (currentCoords == AnandaCoords.BatterySE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 3.0f), (maxCamPos.x + 5.12f * 3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -1.0f), (maxCamPos.y + 5.12f * -1.0f)), depth); } else if (currentCoords == AnandaCoords.BatterySW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 2.0f), (maxCamPos.x + 5.12f * 2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -1.0f), (maxCamPos.y + 5.12f * -1.0f)), depth); } else if (currentCoords == AnandaCoords.BuildersNE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 0.0f), (maxCamPos.x + 5.12f * 0.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 1.0f), (maxCamPos.y + 5.12f * 1.0f)), depth); } else if (currentCoords == AnandaCoords.BuildersNW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -1.0f), (maxCamPos.x + 5.12f * -1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 1.0f), (maxCamPos.y + 5.12f * 1.0f)), depth); } else if (currentCoords == AnandaCoords.BuildersSE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 0.0f), (maxCamPos.x + 5.12f * 0.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 0.0f), (maxCamPos.y + 5.12f * 0.0f)), depth); } else if (currentCoords == AnandaCoords.BuildersSW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -1.0f), (maxCamPos.x + 5.12f * -1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 0.0f), (maxCamPos.y + 5.12f * 0.0f)), depth); } else if (currentCoords == AnandaCoords.Campus) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 0.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -2.0f), (maxCamPos.y + 5.12f * -1.0f)), depth); } else if (currentCoords == AnandaCoords.CannaFieldNW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -2.0f), (maxCamPos.x + 5.12f * -2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -2.0f), (maxCamPos.y + 5.12f * -2.0f)), depth); } else if (currentCoords == AnandaCoords.CannaFieldSE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -1.0f), (maxCamPos.x + 5.12f * -1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -3.0f), (maxCamPos.y + 5.12f * -3.0f)), depth); } else if (currentCoords == AnandaCoords.CannaFieldSW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -2.0f), (maxCamPos.x + 5.12f * -2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -3.0f), (maxCamPos.y + 5.12f * -3.0f)), depth); } else if (currentCoords == AnandaCoords.CannaHouse) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -1.0f), (maxCamPos.x + 5.12f * -1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -2.0f), (maxCamPos.y + 5.12f * -2.0f)), depth); } else if (currentCoords == AnandaCoords.FarmNW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 1.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -3.0f), (maxCamPos.y + 5.12f * -3.0f)), depth); } else if (currentCoords == AnandaCoords.FarmNC) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 2.0f), (maxCamPos.x + 5.12f * 2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -3.0f), (maxCamPos.y + 5.12f * -3.0f)), depth); } else if (currentCoords == AnandaCoords.FarmNE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 3.0f), (maxCamPos.x + 5.12f * 3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -3.0f), (maxCamPos.y + 5.12f * -3.0f)), depth); } else if (currentCoords == AnandaCoords.FarmWC) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 1.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -4.0f), (maxCamPos.y + 5.12f * -4.0f)), depth); } else if (currentCoords == AnandaCoords.FarmCC) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 2.0f), (maxCamPos.x + 5.12f * 2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -4.0f), (maxCamPos.y + 5.12f * -4.0f)), depth); } else if (currentCoords == AnandaCoords.FarmEC) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 3.0f), (maxCamPos.x + 5.12f * 3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -4.0f), (maxCamPos.y + 5.12f * -4.0f)), depth); } else if (currentCoords == AnandaCoords.FarmSW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 1.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -5.0f), (maxCamPos.y + 5.12f * -5.0f)), depth); } else if (currentCoords == AnandaCoords.FarmSC) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 2.0f), (maxCamPos.x + 5.12f * 2.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -5.0f), (maxCamPos.y + 5.12f * -5.0f)), depth); } else if (currentCoords == AnandaCoords.FarmSE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 3.0f), (maxCamPos.x + 5.12f * 3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -5.0f), (maxCamPos.y + 5.12f * -5.0f)), depth); } else if (currentCoords == AnandaCoords.Home) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -3.0f), (maxCamPos.x + 5.12f * -3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -2.0f), (maxCamPos.y + 5.12f * -2.0f)), depth); } else if (currentCoords == AnandaCoords.HousesE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 4.0f), (maxCamPos.x + 5.12f * 4.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -1.0f), (maxCamPos.y + 5.12f * -1.0f)), depth); } else if (currentCoords == AnandaCoords.HousesN) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 0.0f), (maxCamPos.x + 5.12f * 0.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 2.0f), (maxCamPos.y + 5.12f * 2.0f)), depth); } else if (currentCoords == AnandaCoords.HousesS) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 1.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -6.0f), (maxCamPos.y + 5.12f * -6.0f)), depth); } else if (currentCoords == AnandaCoords.HousesW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -4.0f), (maxCamPos.x + 5.12f * -4.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -2.0f), (maxCamPos.y + 5.12f * -2.0f)), depth); } else if (currentCoords == AnandaCoords.Lake) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 1.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 3.0f), (maxCamPos.y + 5.12f * 3.0f)), depth); } else if (currentCoords == AnandaCoords.PlaygroundE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 5.0f), (maxCamPos.x + 5.12f * 5.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -1.0f), (maxCamPos.y + 5.12f * -1.0f)), depth); } else if (currentCoords == AnandaCoords.PlaygroundN) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 1.0f), (maxCamPos.x + 5.12f * 1.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 2.0f), (maxCamPos.y + 5.12f * 2.0f)), depth); } else if (currentCoords == AnandaCoords.PlaygroundS) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 0.0f), (maxCamPos.x + 5.12f * 0.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -6.0f), (maxCamPos.y + 5.12f * -6.0f)), depth); } else if (currentCoords == AnandaCoords.PlaygroundW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -3.0f), (maxCamPos.x + 5.12f * -3.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -1.0f), (maxCamPos.y + 5.12f * -1.0f)), depth); } else if (currentCoords == AnandaCoords.RaceTrackE) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 5.0f), (maxCamPos.x + 5.12f * 5.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -2.0f), (maxCamPos.y + 5.12f * -2.0f)), depth); } else if (currentCoords == AnandaCoords.River) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * 0.0f), (maxCamPos.x + 5.12f * 0.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 3.0f), (maxCamPos.y + 5.12f * 3.0f)), depth); } else if (currentCoords == AnandaCoords.WoodsW) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -5.0f), (maxCamPos.x + 5.12f * -4.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * -1.0f), (maxCamPos.y + 5.12f * 0.0f)), depth); } else if (currentCoords == AnandaCoords.WoodsWSecret) { transform.position = new Vector3( Mathf.Clamp( transform.position.x, (minCamPos.x + 5.12f * -4.0f), (maxCamPos.x + 5.12f * -4.0f)), Mathf.Clamp( transform.position.y, (minCamPos.y + 5.12f * 1.0f), (maxCamPos.y + 5.12f * 1.0f)), depth); } else { transform.position = new Vector3( transform.position.x, transform.position.y, -10 ); } } } }