private void Update() { //Condition For Checking the end of script and destory messagebox if (mOmessageBox && //Check if Message is not NULL ((Input.GetKeyDown("space") || SimpleInput.GetButtonDown("space")) && // Handle Input mLSscripts.Capacity != 0 && // Check if Script is not NULL (mLSscripts.Count == mIcurrentLine))) // Check the end of Script { mOgameLogic.GetComponent <PauseManage>().mBisPaused = false; Destroy(mOmessageBox); } //Condition For Typying the Next Script if (mBisFistMessage || ((Input.GetKeyDown("space") || SimpleInput.GetButtonDown("space")) && mBisPrinted && // Check if messagebox is printed (mLSchainText.Capacity - 1 >= mIcurrentLine))) // Check if the Current line doesnt pass the Scripts { StartCoroutine(WritemLSchainText(mLSchainText[mIcurrentLine])); } //Condition For Skipping current line if (!mBisPrinted && (Input.GetKeyDown("space") || SimpleInput.GetButtonDown("space"))) { SkipMessage(); } }
private void OnTriggerStay2D(Collider2D other) { Hint.SetActive(true); if (other.gameObject.tag == "Player") { if (SimpleInput.GetButtonDown("Inspect")) { Object.SetActive(false); objectobtain = false; Achievements.SetActive(true); s = 1; Achievement(); if (quest != null) { quest.gameObject.GetComponent <Quest>().gotItem = true; } } if (objectobtain == false) { Hint.SetActive(false); Dialoguetips.SetActive(false); } } }
// Update is called once per frame private void Update() { if (GameManager.instance.IsGameOver()) { return; } UpdateMovement(); UpdateFellowMovement(); if (Input.GetKeyDown(KeyCode.Space) || SimpleInput.GetButtonDown("Light")) { if (flashLight.LifeBattery()) { lightOn = !lightOn; } } FlashLightToggle(lightOn); PlayerStack.instance.PlayerFear(numberHumanNotFear, maxFear); if (PlayerStack.ReachFearLimit()) { GameManager.instance.EndGame(); } if (lightOn) { flashLight.PlayerBattery(flashLight.maxBattery); } }
void Update() { if (SimpleInput.GetAxis("Horizontal") != 0 || SimpleInput.GetAxis("Vertical") != 0) { SendMovementInfo(SimpleInput.GetAxis("Horizontal"), SimpleInput.GetAxis("Vertical")); if (Mathf.Abs(SimpleInput.GetAxis("Horizontal")) > 0.85f || Mathf.Abs(SimpleInput.GetAxis("Vertical")) > 0.85f) { SendBoostInfo(1); } else { SendBoostInfo(0); } } if (SimpleInput.GetButton("Fire")) { SendShootingInfo(); } if (SimpleInput.GetButtonDown("Powerup")) { SendPowerupInfo(); } //if (SimpleInput.GetButton("Boost")) //{ // SendBoostInfo(1); //} else if (SimpleInput.GetButtonUp("Boost")) //{ // SendBoostInfo(0); //} }
/// <summary> /// Methode de gestion des dialogues d'un PNJ /// </summary> /// <param name="collision"></param> private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { cam.TxtAction.text = npcName; if (!StaticClass.disableInput && SimpleInput.GetButtonDown("Fire1")) { StaticClass.disableInput = true; GetComponentInParent <NPC>().talking = true; BeforeFirstMessage(collision); dialogue.Interact(GetComponent <VIDE_Assign>()); } else if (StaticClass.disableInput && (SimpleInput.GetButtonDown("Fire1") || SimpleInput.GetButtonDown("Touch anywhere"))) { if (!dialogue.playerContainer.activeSelf) //affiche le prochain dialogue au clic seulement si ce n'est pas une question { dialogue.CallNext(); } if (!dialogue.IsActive()) { StaticClass.disableInput = false; GetComponentInParent <NPC>().talking = false; } } } }
private void Update() { if (!m_Jump) { m_Jump = SimpleInput.GetButtonDown("Jump"); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { cam.TxtAction.text = comName; float points = PointsSystem.categories[categoryName].Points; float total = PointsSystem.categories[categoryName].Total; if (!StaticClass.disableInput && SimpleInput.GetButtonDown("Vertical") && SimpleInput.GetAxis("Vertical") > 0) { if (points >= total * seuil - 0.1) { gameObject.AddComponent <Door>(); GetComponent <Door>().destinationDoor = GameObject.Find(gameObject.name).GetComponent <Door>(); GetComponent <Door>().destinationName = comName; GameObject.Find(gameObject.name).GetComponent <Door>().destinationDoor = GetComponent <Door>(); cam.customText.text = "Félicitation ! Vous avez débloqué la porte"; cam.customText.transform.parent.gameObject.SetActive(true); } else { cam.customText.text = "Vous devez avoir au minimum " + total * seuil + " points dans le domaine " + categoryName + " pour utiliser cettre compétence."; cam.customText.transform.parent.gameObject.SetActive(true); } StaticClass.disableInput = true; } else if (StaticClass.disableInput && SimpleInput.GetButtonDown("Vertical") && SimpleInput.GetAxis("Vertical") > 0 || SimpleInput.GetButtonDown("Touch anywhere")) { cam.customText.text = string.Empty; cam.customText.transform.parent.gameObject.SetActive(false); StaticClass.disableInput = false; } } }
private void InputDetection() { var horizontal = SimpleInput.GetAxis("Horizontal"); if (horizontal < 0f) { state.HideShield(); state.MoveLeft(); } else if (horizontal > 0f) { state.HideShield(); state.MoveRight(); } else if (horizontal == 0f) { state.GetIdle(); } var vertical = SimpleInput.GetAxis("Vertical"); if (SimpleInput.GetButton("Jump") || vertical > 0f) { state.MoveUp(); } else if (vertical < 0f) { state.MoveDown(); } if (SimpleInput.GetButton("Fire1")) { state.HideShield(); state.UseWeapon(); } else { if (SimpleInput.GetButtonDown("Fire2")) { state.UseShield(); } else if (SimpleInput.GetButtonUp("Fire2")) { state.HideShield(); } } if (SimpleInput.GetButton("Jump")) { GameManager.S.PauseUnpause(); } if (Application.platform == RuntimePlatform.Android) { if (Input.GetKeyDown(KeyCode.Escape)) { GameManager.S.PauseUnpause(); } } }
private void Control() { if (Gamecontroller.TotalLife > 0 && !Gamecontroller.GameEnd) {//eixos de movimento Movement.x = SimpleInput.GetAxis("Horizontal"); Movement.z = SimpleInput.GetAxis("Vertical"); IsGrounded = Physics.CheckSphere(Feet.position, GroundDistance, GroundLayer, QueryTriggerInteraction.Ignore); SpeedY = Body.velocity.y; //verifica o input dos botões, para funcionar com controles também if (SimpleInput.GetButtonDown("Jump")) { Jumping(); } if (SimpleInput.GetButtonDown("Fire1")) { Atacking(); } if (SimpleInput.GetButtonDown("Fire2")) { Masking(); } if (SimpleInput.GetButtonDown("Fire3")) { Rescuing(); } } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { txtAction.text = destinationName; if (SimpleInput.GetButtonDown("Vertical") && SimpleInput.GetAxis("Vertical") < 0) { collision.gameObject.GetComponent <Player>().animator.SetBool("isAssis", true); //*** Arrete de mouvement horizontaux ***// StaticClass.disableInput = true; //*** positionnnement du player assis sur le sprite de la chaise ***// //collision.gameObject.GetComponent<SpriteRenderer>().flipX = false; //collision.gameObject.transform.position = transform.position; chair1 = GameObject.Find("ChairPosition"); chair2 = GameObject.Find("player-chair"); Vector3 position = new Vector3(0, 0, 0); position.x = chair1.transform.position.x; position.y = chair1.transform.position.y; position.z = chair1.transform.position.z; chair2.transform.position = position; } if (SimpleInput.GetButtonDown("Vertical") && SimpleInput.GetAxis("Vertical") > 0) { collision.gameObject.GetComponent <Player>().animator.SetBool("isAssis", false); StaticClass.disableInput = false; } } }
void Update() { if (SimpleInput.GetButtonDown("attack") | Input.GetKeyDown(KeyCode.Space) && PlayerState == PlayerStates.Strange) { PlayerState = PlayerStates.Reload; Strange = StrangeMin; ThrowSnowball(); attackTimer = AttackInterval; } if (PlayerState == PlayerStates.Strange) { StrangeLerp(); TrajectoryRender(); } else { attackTimer -= Time.deltaTime; if (attackTimer <= 0) { PlayerState = PlayerStates.Strange; } } MoveUpdate(); AnimationUpdate(); }
protected void Update() { if (SimpleInput.GetButtonDown("Reset Camera") && m_ResetTurnSpeed > 0) { isResettingCamera = true; } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { cam.TxtAction.text = comName; float points = PointsSystem.categories[categoryName].Points; float total = PointsSystem.categories[categoryName].Total; if (!StaticClass.disableInput && SimpleInput.GetButtonDown("Fire1")) { if (points >= total * seuil - 0.1) { cam.TxtDialog.text = "Félicitation ! Vous avez changé vos notes à l'insu du doyen. Nouvelle moyenne : 6.0"; } else { cam.TxtDialog.text = "Vous devez avoir au minimum " + total * seuil + " points dans le domaine " + categoryName + " pour utiliser cettre compétence."; } cam.TxtDialog.transform.parent.gameObject.SetActive(true); StaticClass.disableInput = true; } else if (StaticClass.disableInput && (SimpleInput.GetButtonDown("Fire1") || SimpleInput.GetButtonDown("Touch anywhere"))) { Camera.main.GetComponent <CameraScript>().TxtAction.text = string.Empty; cam.TxtDialog.transform.parent.gameObject.SetActive(false); StaticClass.disableInput = false; } } }
private void OnTriggerStay2D(Collider2D other) { if (SimpleInput.GetButtonDown("Talk")) { TriggerDialogue(); } }
// Update is called once per frame void Update() { if (!enPausa) { if (SimpleInput.GetButtonDown("Fire1") && puedeDisparar && balasNormales > 0) { DisparoBala(); } } }
// waits for input from m_InputController and checks m_CanExecuteButtons void Update() { if (m_InZone) { if (m_InputController != null && SimpleInput.GetButtonDown("Interact")) //m_InputController.input.pressed) { OnInteractButtonPress(); } } }
private void Update() { //InputHandling if (inRange && SimpleInput.GetButtonDown("Talk")) { if (gameObject.GetComponent <Quest>().gotItem) { sentence = sucessSentence; questText.fontStyle = FontStyles.Strikethrough | FontStyles.Bold; } if (!root.gameObject.activeInHierarchy) { ShowDialogue(); canDisplay = true; } else { HideDialogue(); reset(); } } if (!canDisplay) { return; } //Dialog Display Handling if (index < sentence.Length) { if (fullSentenceDisplayed) { if (timer <= 0f) { fullSentenceDisplayed = false; fullText = sentence[index]; StartCoroutine(ShowText()); } else { timer -= Time.deltaTime; } } } else { if (fullSentenceDisplayed) { if (timer <= 0f) { reset(); } } } }
void Update() { RigidbodyConstraints previousConstraints = m_Rigidbody.constraints; m_Player.transform.rotation = Quaternion.Euler(0, transform.rotation.eulerAngles.y, 0); if (m_Player.transform.position.y < H_balandlik) { m_Rigidbody.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX; m_froze = true; } if (Input.GetKey(KeyCode.UpArrow) && m_froze) { //Move the Rigidbody forwards constantly at speed you define (the blue arrow axis in Scene view) m_Rigidbody.velocity = transform.forward * m_Speed; } if (SimpleInput.GetButtonDown(jumpButton)) { m_froze = false; m_Rigidbody.constraints = RigidbodyConstraints.None; m_Rigidbody.constraints = RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX; m_Rigidbody.AddForce(0f, 10f, 0f, ForceMode.Impulse); } if (Input.GetKey(KeyCode.F)) { m_Rigidbody.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX; } if (Input.GetKey(KeyCode.G)) { m_Rigidbody.constraints = RigidbodyConstraints.None; m_Rigidbody.constraints = RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX; } if (Input.GetKey(KeyCode.DownArrow) && m_froze) { //Move the Rigidbody backwards constantly at the speed you define (the blue arrow axis in Scene view) m_Rigidbody.velocity = -transform.forward * m_Speed; } if (Input.GetKey(KeyCode.RightArrow) && m_froze) { //Rotate the sprite about the Y axis in the positive direction transform.Rotate(new Vector3(0, 1, 0) * Time.deltaTime * n_Speed, Space.World); } if (Input.GetKey(KeyCode.LeftArrow) && m_froze) { //Rotate the sprite about the Y axis in the negative direction transform.Rotate(new Vector3(0, -1, 0) * Time.deltaTime * n_Speed, Space.World); } }
// Update is called once per frame void Update() { if (isLocalPlayer) { if (SimpleInput.GetButtonDown("Flashlight")) { CmdSwitchFlashlight(); lightGameObject.enabled = !lightGameObject.enabled; } } }
void Update() { change = Vector3.zero; change.x = SimpleInput.GetAxisRaw("Horizontal"); change.y = SimpleInput.GetAxisRaw("Vertical"); UpdateAnimationsAndMove(); if (SimpleInput.GetButtonDown("A button") || Input.GetKeyDown(KeyCode.Z)) { test.text = "it's working A";//test button log idleTooLong = false; playerAnimator.SetBool("idle2long", false); } else if (SimpleInput.GetButtonDown("B button") || Input.GetKeyDown(KeyCode.X)) { test.text = "it's working B"; idleTooLong = false; playerAnimator.SetBool("idle2long", false); } if (taps > 0) { idleTooLong = false; playerAnimator.SetBool("idle2long", false); timer += Time.deltaTime; if (taps == 1) { if (timer >= maxWaitTime) { taps = 0; } } else if (taps > 1) { if (timer < maxWaitTime) { dashing = true; dashSpeed = 10f; } else { taps = 0; dashing = false; } } } else { timer = 0f; } if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("idle")) { playerPS.Play(); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { Camera.main.GetComponent <CameraScript>().TxtAction.text = "Prendre le bus est s'enfuir"; if (!StaticClass.disableInput && SimpleInput.GetButtonDown("Vertical") && SimpleInput.GetAxis("Vertical") > 0) { //collision.gameObject.GetComponent<SpriteRenderer>().enabled = false; SceneManager.LoadScene("Congratulation"); } } }
void Update() { inputHorizontal = SimpleInput.GetAxis(horizontalAxis); inputVertical = SimpleInput.GetAxis(verticalAxis); transform.Rotate(0f, inputHorizontal * 5f, 0f, Space.World); if (SimpleInput.GetButtonDown(jumpButton) && IsGrounded()) { m_rigidbody.AddForce(0f, 10f, 0f, ForceMode.Impulse); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { txtAction.text = destinationName; if (!StaticClass.disableInput && SimpleInput.GetButtonDown("Vertical") && SimpleInput.GetAxis("Vertical") > 0) { Sound(); collision.gameObject.transform.position = destinationDoor.transform.position; Camera.main.transform.position = new Vector3(destinationDoor.transform.position.x, destinationDoor.transform.position.y, Camera.main.transform.position.z); } } }
// Update is called once per frame void Update() { bool shoot = SimpleInput.GetButtonDown("Fire"); shoot |= Input.GetButtonDown("Fire1"); if (shoot) { Weapon?.Shoot(); } x = SimpleInput.GetAxis("Horizontal"); y = SimpleInput.GetAxis("Vertical"); angle = Mathf.Atan2(0 - y, 0 - x) / Mathf.PI * 180; movement = new Vector2(speed.x * x * Time.deltaTime, speed.y * y * Time.deltaTime); }
protected void Update() { if (SimpleInput.GetButtonDown("Reset Camera") && m_AutoScript.IsDoubleResetReady) { m_IsResettingCamera = true; m_TiltDistanceFrameIsChanging = true; m_ClipScript.maxDistanceIsChanging = true; } HandleRotationMovement(); if (m_LockCursor && Input.GetMouseButtonUp(0)) { Cursor.lockState = m_LockCursor ? CursorLockMode.Locked : CursorLockMode.None; Cursor.visible = !m_LockCursor; } }
private void FixedUpdate() { transform.position = Vector3.MoveTowards(transform.position, new Vector3( Mathf.Clamp(player.transform.position.x, minPosition.x + width / 2f, maxPosition.x - width / 2f), Mathf.Clamp(player.transform.position.y, minPosition.y + height / 2f, maxPosition.y - height / 2f), transform.position.z ), 50 * Time.fixedDeltaTime); if (SimpleInput.GetButtonDown("Cancel")) { StaticClass.disableInput = true; pauseMenu.SetActive(true); } }
private void PcControlls() { if (SimpleInput.GetButtonDown("Jump")) { OnPressJump(); } else if (SimpleInput.GetButtonUp("Jump")) { OnReleaseJump(); } if (SimpleInput.GetButtonDown("Dash") && dashEnabled) { OnPressDash(); } }
// Update is called once per frame void Update() { horizontalMove = SimpleInput.GetAxisRaw("Horizontal") * runSpeed; if (SimpleInput.GetButtonDown("Jump")) { jump = true; } if (SimpleInput.GetButtonDown("Crouch")) { crouch = true; } else if (SimpleInput.GetButtonUp("Crouch")) { crouch = false; } }
void Update() { if (enableControl) { horizontalMove = SimpleInput.GetAxisRaw("Horizontal") * runSpeed; if (SimpleInput.GetButtonDown("Crouch")) { crouch = true; } else if (SimpleInput.GetButtonUp("Crouch")) { crouch = false; } if (SimpleInput.GetButtonDown("Jump") && isGrounded && jump == false) { // The player starts to jump from any ground jump = true; } else if (SimpleInput.GetButtonUp("Jump") && !isGrounded && jumpCancel == false) { // The player starts to cancel jumping in the air jumpCancel = true; } // Player begins to attack if (SimpleInput.GetButtonDown("Fire1") && !attack) { StartCoroutine(AttackCoroutine()); } } // Update animation m_Animator.SetFloat("Speed", Mathf.Abs(horizontalMove)); m_Animator.SetBool("IsGrounded", isGrounded); m_Animator.SetBool("Sneaking", crouch); // Play SFX if (jump) { m_PlayerSFXource.PlayOneShot(jumpSFXClip); } }
private void CheckCrosshair() { Ray ray = camera.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(ray.origin, ray.direction); // RaycastHit[] hits = Physics.RaycastAll(ray); RaycastHit hit; if (Physics.SphereCast(ray, 0.2f, out hit, maxUseDistance, raycastMask)) { if (hit.collider.tag != "Interactable") { if (useButton) { useButton.active = false; } usableGameObject = null; return; } usableGameObject = hit.collider.gameObject; if (useButton) { useButton.active = true; } NetworkedButton nb = hit.collider.gameObject.GetComponent <NetworkedButton>(); if (nb != null && SimpleInput.GetButtonDown("Use")) { nb.CmdExecuteAction(); } } else { usableGameObject = null; if (useButton) { useButton.active = false; } } }