public void InvestigateElement() { touches.Vibrate(); if (this.bIsMine) { // Show all mines MineGrid.uncoverMines(); // Game Over ms.bHasLost = true; } else { // Show adjacent mine number int x = (int)transform.position.x; int y = (int)transform.position.y; LoadTexture(MineGrid.adjacentMines(x, y)); // Uncover area w/out mines MineGrid.FFuncover(x, y, new bool[MineGrid.w, MineGrid.h]); // Find out if the game was won if (MineGrid.bIsFinished()) { ms.bHasWon = true; } } touches.bAaction = false; }
void Update() { // Flip tile if (gwc.bCanFlip && !spLogic.bGuessingFTW && bHasEntered && !bHasExited && !pause.bPauseActive && !dMan.bDialogueActive && !dMan.bPauseDialogue && (Input.GetButtonDown("Action") || touches.bAaction)) { CheckAndFlip(); } // Tile layer changer if (gwc.bCanFlip && !dMan.bDialogueActive && !pause.bPauseActive && !bAvoidUpdate && (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift) || Input.GetKeyDown(KeyCode.JoystickButton4) || Input.GetKeyDown(KeyCode.JoystickButton5) || touches.bBaction || (Input.GetMouseButtonDown(1) && Input.touchCount < 2))) { touches.Vibrate(); FlipLayer(); } // Reset tile layer changer for keyboard if (!pause.bPauseActive && (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift) || Input.GetKeyUp(KeyCode.JoystickButton4) || Input.GetKeyUp(KeyCode.JoystickButton5) || (Input.GetMouseButtonUp(1) && !uMan.bMobileDevice))) { bAvoidUpdate = false; } // Reset tile layer changer for GUI B button if (!touches.bBaction && bAvoidUpdate) { bAvoidUpdate = false; } }
void Update() { // Flip tile if (gwc.bCanFlip && !spLogic.bGuessingFTW && bHasEntered && !bHasExited && !pause.bPauseActive && !dMan.bDialogueActive && !dMan.bPauseDialogue && (Input.GetButtonDown("Action") || contSupp.ControllerButtonPadBottom("down") || touches.bAaction)) { CheckAndFlip(); } // Tile layer changer if (gwc.bCanFlip && !dMan.bDialogueActive && !pause.bPauseActive && !bAvoidUpdate && (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift) || contSupp.ControllerButtonPadRight("down") || touches.bBaction || (Input.GetMouseButtonDown(1) && Input.touchCount < 2))) { touches.Vibrate(); FlipLayer(); } // Reset tile layer changer for keyboard if (!pause.bPauseActive && (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift) || contSupp.ControllerButtonPadRight("up") || (Input.GetMouseButtonUp(1) && devDetect.bIsMobile))) { bAvoidUpdate = false; } // Reset tile layer changer for GUI B button if (!touches.bBaction && bAvoidUpdate) { bAvoidUpdate = false; } }
public void OpenItemMenu(bool bItemOpen) { if (item) { if (bItemOpen) { touches.Vibrate(); // "Lock" Joystick to horizontal direction fixedJoy.joystickMode = JoystickMode.Horizontal; inv.selectedItemId = this.itemId; PopulateItemMenu(item); stuffBack.transform.localScale = Vector3.zero; itemMenu.gameObject.GetComponent <CanvasGroup>().blocksRaycasts = true; itemMenu.gameObject.GetComponent <CanvasGroup>().interactable = true; itemMenu.gameObject.GetComponent <CanvasGroup>().alpha = 1; } else { // "Unlock" Joystick from horizontal direction fixedJoy.joystickMode = JoystickMode.AllAxis; stuffBack.transform.localScale = Vector3.one; itemMenu.gameObject.GetComponent <CanvasGroup>().blocksRaycasts = false; itemMenu.gameObject.GetComponent <CanvasGroup>().interactable = false; itemMenu.gameObject.GetComponent <CanvasGroup>().alpha = 0; } } }
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("DialogueAction") && !uMan.bControlsActive))) { touches.Vibrate(); if (currentLine < dialogueLines.Length) { currentLine++; // 05/10/2019 DC -- Avoids the GWC double tap bug if (!oMan.bOptionsActive) { touches.bAaction = false; } } } // Set current text whenever Options are hidden if (bDialogueActive && !oMan.bOptionsActive && currentLine <= dialogueLines.Length - 1) { dText.text = dialogueLines[currentLine]; } // Show Options if present and w/ the last dialogue prompt; otherwise, reset the dialogue if (bDialogueActive && oMan.bDiaToOpts && !oMan.bOptionsActive && currentLine >= dialogueLines.Length - 1) { oMan.ShowOptions(); } else if (!oMan.bOptionsActive && currentLine >= dialogueLines.Length) { ResetDialogue(); } // Temp: Update Camera display / aspect ratio if (Input.GetKeyUp(KeyCode.R) || Input.GetKeyUp(KeyCode.JoystickButton6)) { ConfigureParameters(); uMan.CheckAndSetMenus(); } //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() { if (controlsMenu.localScale == Vector3.one) { // Controller Support if (!contSupp.bIsMoving && fixedJoystick.Vertical == 0 && fixedJoystick.Horizontal == 0 && (!touches.bDown && !touches.bUp && !touches.bLeft && !touches.bRight)) { bFreezeControllerInput = false; } else if (!bFreezeControllerInput && (contSupp.ControllerDirectionalPadVertical() < 0 || contSupp.ControllerLeftJoystickVertical() < 0 || touches.bDown || (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) && fixedJoystick.Vertical < 0))) { bControllerDown = true; bFreezeControllerInput = true; } else if (!bFreezeControllerInput && (contSupp.ControllerDirectionalPadVertical() > 0 || contSupp.ControllerLeftJoystickVertical() > 0 || touches.bUp || (Mathf.Abs(fixedJoystick.Vertical) > Mathf.Abs(fixedJoystick.Horizontal) && fixedJoystick.Vertical > 0))) { bControllerUp = true; bFreezeControllerInput = true; } else if (!bFreezeControllerInput && (contSupp.ControllerDirectionalPadHorizontal() > 0 || contSupp.ControllerLeftJoystickHorizontal() > 0 || fixedJoystick.Horizontal > 0 || touches.bRight)) { bControllerRight = true; bFreezeControllerInput = true; } else if (!bFreezeControllerInput && (contSupp.ControllerDirectionalPadHorizontal() < 0 || contSupp.ControllerLeftJoystickHorizontal() < 0 || fixedJoystick.Horizontal < 0 || touches.bLeft)) { bControllerLeft = true; bFreezeControllerInput = true; } if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow) || bControllerDown) { bControllerDown = false; if (currentPosition == SelectorPosition.showButtons) { currentPosition = SelectorPosition.opacitySlider; ClearAllSelectors(); buttonOpacitySelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.opacitySlider) { currentPosition = SelectorPosition.dPad; ClearAllSelectors(); dPadSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.dPad) { currentPosition = SelectorPosition.vibrate; ClearAllSelectors(); vibrateSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.vibrate) { currentPosition = SelectorPosition.description; ClearAllSelectors(); controlsDescriptionSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.description) { currentPosition = SelectorPosition.back; ClearAllSelectors(); backSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.back) { currentPosition = SelectorPosition.showButtons; ClearAllSelectors(); showButtonsSelector.transform.localScale = Vector3.one; } } else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow) || bControllerUp) { bControllerUp = false; if (currentPosition == SelectorPosition.back) { currentPosition = SelectorPosition.description; ClearAllSelectors(); controlsDescriptionSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.description) { currentPosition = SelectorPosition.vibrate; ClearAllSelectors(); vibrateSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.vibrate) { currentPosition = SelectorPosition.dPad; ClearAllSelectors(); dPadSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.dPad) { currentPosition = SelectorPosition.opacitySlider; ClearAllSelectors(); buttonOpacitySelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.opacitySlider) { currentPosition = SelectorPosition.showButtons; ClearAllSelectors(); showButtonsSelector.transform.localScale = Vector3.one; } else if (currentPosition == SelectorPosition.showButtons) { currentPosition = SelectorPosition.back; ClearAllSelectors(); backSelector.transform.localScale = Vector3.one; } } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow) || bControllerLeft) { bControllerLeft = false; if (currentPosition == SelectorPosition.opacitySlider) { uMan.DecreaseOpacity(); } } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow) || bControllerRight) { bControllerRight = false; if (currentPosition == SelectorPosition.opacitySlider) { uMan.IncreaseOpacity(); } } else if ((Input.GetButtonDown("Action") || contSupp.ControllerButtonPadBottom("down") || touches.bAaction)) { if (currentPosition == SelectorPosition.showButtons) { showButtonsToggle.isOn = !showButtonsToggle.isOn; uMan.ToggleControls(); touches.Vibrate(); } else if (currentPosition == SelectorPosition.dPad && !uMan.bOnlyDPad) { dPadToggle.isOn = !dPadToggle.isOn; uMan.ToggleDPadControl(); touches.Vibrate(); } else if (currentPosition == SelectorPosition.vibrate) { vibrateToggle.isOn = !vibrateToggle.isOn; touches.ToggleVibrate(); touches.Vibrate(); } else if (currentPosition == SelectorPosition.back) { ResetSelectors(); movePMA.bDelayAction = true; pause.Controls(false); } touches.bAaction = false; } else if (Input.GetKeyDown(KeyCode.Escape) || contSupp.ControllerMenuRight("down") || contSupp.ControllerButtonPadRight("down") || Input.GetButton("BAction") || touches.bBaction) { ResetSelectors(); } if (contSupp.ControllerRightJoystickVertical() > 0) { if (controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>(). offsetMin.y < 0) { controlsMenu.GetChild(0).GetChild(0).localPosition = new Vector3( controlsMenu.GetChild(0).GetChild(0).localPosition.x, controlsMenu.GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(), controlsMenu.GetChild(0).GetChild(0).localPosition.z); } else { controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>(). offsetMin = new Vector2(controlsMenu.GetChild(0). GetChild(0).GetComponent <RectTransform>().offsetMin.x, 0); } } else if (contSupp.ControllerRightJoystickVertical() < 0) { if (controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>(). offsetMax.y * -1f < 0) { controlsMenu.GetChild(0).GetChild(0).localPosition = new Vector3( controlsMenu.GetChild(0).GetChild(0).localPosition.x, controlsMenu.GetChild(0).GetChild(0).localPosition.y + 10 * contSupp.ControllerRightJoystickVertical(), controlsMenu.GetChild(0).GetChild(0).localPosition.z); } else { controlsMenu.GetChild(0).GetChild(0).GetComponent <RectTransform>(). offsetMax = new Vector2(controlsMenu.GetChild(0). GetChild(0).GetComponent <RectTransform>().offsetMax.x, 0); } } // Dev Support if (currentPosition == SelectorPosition.opacitySlider && (Input.GetButton("Action") || contSupp.ControllerButtonPadBottom("hold") || (touches.bAvoidSubUIElements && touches.bUIactive))) { devSupportTimer -= 0.01f; if (devSupportTimer <= 0) { bDevSupportActive = !bDevSupportActive; ToggleDevSupport(); } } } }
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); //} }