void FixedUpdate() { //left right jump movement movement if (CnInputManager.GetAxis("Horizontal") > 0) { moveRight(); } if (CnInputManager.GetAxis("Horizontal") < 0) { moveLeft(); } if (CnInputManager.GetButtonDown("Jump")) { jump(); } //stop if (playerRb.velocity.x == 0) { stopPlayer(); } if (CnInputManager.GetButtonDown("Jump") && playerRb.velocity.x == 0) { sjump(); } }
// Update is called once per frame void Update() { Vel_Y = RB.velocity.y; Move = CnInputManager.GetAxis("Horizontal") * Time.deltaTime * Move_Speed; transform.position = transform.position + new Vector3(Move, 0, 0); if (Move > 0 || (CnInputManager.GetButtonDown("Horizontal"))) { transform.localEulerAngles = new Vector3(0, 0, 0); AnimGato.SetBool("isWalking", true); } else if (Move < 0 || (CnInputManager.GetButtonDown("Horizontal"))) { transform.localEulerAngles = new Vector3(0, 180, 0); AnimGato.SetBool("isWalking", true); } else if (!Input.anyKey) { AnimGato.SetBool("isWalking", false); } if ((Input.GetButton("Jump") || CnInputManager.GetButtonDown("Jump")) && Grounded == true && Space_Down == false) { audio.clip = Salto; audio.Play(); AnimGato.SetBool("Jump", true); RB.AddForce(0, Jump, 0); Space_Down = true; } if (Input.GetKey(KeyCode.Space) != true) { Space_Down = false; } if (RB.velocity.y < 0) { AnimGato.SetBool("Jump", false); AnimGato.SetBool("Falling", true); } if (Grounded == true) { AnimGato.SetBool("Falling", false); } if (transform.position.y < -4.9f) { audio.clip = Muerte; audio.Play(); transform.position = new Vector3(-0.28f, 2.3f, 5); Destroy(GameObject.FindGameObjectWithTag("Pajaro")); if (Vidas != 0) { GameObject.Find("Vida" + Vidas).SetActive(false); Vidas--; } } }
// UPDATE void Update() { timeLeft -= Time.deltaTime; timeText.text = timeLeft.ToString("F1"); timeTextBack.text = timeLeft.ToString("F1"); // Gameover at 0:00 if (timeLeft <= 0.0) { gameObject.SetActive(false); GameOver(); } countText.text = count + ""; //display score countTextBack.text = count + ""; //display score if (CnInputManager.GetButtonDown("Jump")) { PlaySound(2); rb2d.AddForce(Vector2.up * jumpHeight); } if (CnInputManager.GetButtonDown("Mute")) { MuteButton(); } }
// Update is called once per frame void Update() { if (grounded && (Input.GetKeyDown(KeyCode.C) || CnInputManager.GetButtonDown("Jump"))) { textForDebug.text = "touchCount" + Input.touchCount; anim.SetBool("Ground", false); rigidBody2D.AddForce(Vector2.up * jumpForce, ForceMode2D.Force); //rigidBody2D.velocity = new Vector2(rigidBody2D.velocity.x, rigidBody2D.velocity.y - jumpForce); } if (Input.GetKeyDown(KeyCode.R) || CnInputManager.GetButtonDown("ChangeWeapon")) { anim.SetTrigger("ChangeWeapon"); int curWeaponState = anim.GetInteger("WeaponState"); if (curWeaponState == 0) { anim.SetInteger("WeaponState", 1); curWeaponState = 1; } else if (curWeaponState == 1) { anim.SetInteger("WeaponState", 0); curWeaponState = 0; } } //if (Input.GetKeyDown(KeyCode.T)) //{ // // anim.SetTrigger("ChangeWeapon"); // anim.SetInteger("WeaponState", 0); //} }
// Update is called once per frame void Update() { if (CnInputManager.GetButtonDown("ReturnToMenu")) { SceneManager.LoadScene("mainMenu"); } }
// Update is called once per frame void Update() { if (!isLocalPlayer || skill.isCooldown()) { return; } if (CnInputManager.GetButtonDown(simpleButtonName)) { skill.ButtonDown(); } if (CnInputManager.GetButtonUp(simpleButtonName) && !cancelSkill) { skill.ButtonUp(); } if (CnInputManager.GetButtonUp(simpleButtonName) && cancelSkill) { skill.ButtonCancel(); } if (!isPressButton && CnInputManager.GetButton(simpleButtonName)) { skill.ButtonDirection(CnInputManager.GetAxis(verticalButtonName), CnInputManager.GetAxis(horizontalButtonName)); } if (CnInputManager.GetButtonDown("CancelSkill")) { cancelSkill = true; } if (CnInputManager.GetButtonUp("CancelSkill")) { cancelSkill = false; } }
void JumpInput() { if (CnInputManager.GetButtonDown("JumpBtn") && isGrounded) { isJumping = true; jumpTimeCounter = jumpTime; rb.velocity = new Vector2(rb.velocity.x, jumpForce); } if (CnInputManager.GetButton("JumpBtn") && isJumping) { if (jumpTimeCounter > 0) { rb.velocity = Vector2.up * jumpForce; jumpTimeCounter -= Time.deltaTime; } else { isJumping = false; } } if (CnInputManager.GetButtonUp("JumpBtn")) { isJumping = false; } }
void FixedUpdate() { State = DarthState.stoping; CheckGround(); if (Convert.ToBoolean(CnInputManager.GetAxis("Horizontal"))) { Run(); } if (isGrounded && CnInputManager.GetButtonDown("Jump")) { Jump(); } if (CnInputManager.GetButtonDown("Attack")) { Shoot(); } ////чтобы часто не стрелять //shotsTimeCounter -= Time.deltaTime; //фича высоко не прыгать if (gameObject.transform.position.y >= 5.500000F) { gameObject.transform.position = new Vector2(gameObject.transform.position.x, 5.500000F); } }
private void Update() { if (CnInputManager.GetButtonDown("Jump") && IsGrounded()) { _jumpNextFixedUpdate = true; } }
// handle the buttons to select weapon private void handleWeaponSelect() { if (Input.GetButtonDown("Weapon1") || CnInputManager.GetButtonDown("Weapon1")) { loadWeapon(weapons.Bolt); // For laser ((LaserWeapon)weapons.Laser).endFire(); } else if (Input.GetButtonDown("Weapon2") || CnInputManager.GetButtonDown("Weapon2")) { loadWeapon(weapons.Sphere); // For laser ((LaserWeapon)weapons.Laser).endFire(); } else if (Input.GetButtonDown("Weapon3") || CnInputManager.GetButtonDown("Weapon3")) { loadWeapon(weapons.Laser); } }
protected virtual bool IsJumping(bool isGrounded) { if (localPlayer) { if (justJumped) { return(false); } bool pressedJump = CnInputManager.GetButtonDown("Jump Button") && !justJumped; bool isJumping = pressedJump && isGrounded; if (isJumping && !remoteJumping) { remoteJumping = true; SendPlayerDataToServer(); } else if (!isJumping && remoteJumping) { remoteJumping = false; SendPlayerDataToServer(); } } return(remoteJumping); }
private void _ready(IEntity entity) { var isDashing = CnInputManager.GetButtonDown("Dash"); if (isDashing) { var playerComponent = entity.GetComponent <PlayerComponent>(); var viewComponent = entity.GetComponent <ViewComponent>(); var go = viewComponent.View.gameObject; var rigidbody2D = go.GetComponent <Rigidbody2D>(); var directionVector = new Vector2( CnInputManager.GetAxisRaw("DirectionHorizontal"), CnInputManager.GetAxisRaw("DirectionVertical") ); var ghostEffect = go.GetComponent <GhostEffect>(); directionVector = directionVector.sqrMagnitude > 0.001f ? directionVector : (Vector2)go.transform.up; _originalVelocity = rigidbody2D.velocity; rigidbody2D.velocity = directionVector.normalized * 3.5f; ghostEffect.ghostingEnabled = true; playerComponent.isDashing = true; _dashState = DashState.Dashing; } }
/// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// </summary> void Update() { if (CnInputManager.GetButtonDown("Jump")) { star_scene(); } }
// Update is called once per frame void Update() { if (Time.realtimeSinceStartup > delayTime + .5f && delayed == false) { delayed = true; } if (Physics2D.Raycast(transform.position, Vector2.down, 1, playerLayer) && CnInputManager.GetButtonDown("Jump") && !signOpen && Player_Controller.player_controller.lastMove.y == 1 && Camera_Controller.paused == false && Player_Controller.player_controller.inDialogue == false) { canvas.SetActive(true); Player_Controller.player_controller.disableControls = true; Player_Controller.player_controller.inDialogue = true; signOpen = true; delayed = false; delayTime = Time.realtimeSinceStartup; } if (CnInputManager.GetButtonDown("Jump") && signOpen == true && delayed) { signOpen = false; canvas.SetActive(false); Player_Controller.player_controller.disableControls = false; Player_Controller.player_controller.inDialogue = false; } if (text.text != signText) { text.text = signText; } }
public void Update() { if (CnInputManager.GetButtonDown("Fire")) { Shoot(); } }
void Update() { if (CnInputManager.GetButtonDown("Fire3")) { Instantiate(a, this.transform.position, this.transform.rotation); } }
public override bool IsActionDown(string action) { foreach (var i in inputsMap) { if (i.action == action) { #if UP_USE_CN_INPUT_MANAGER if (SystemInfo.deviceType == DeviceType.Handheld) { return(CnInputManager.GetButtonDown(i.handheld)); } #endif #if UP_USE_WII_INPUT_MANAGER if (remote != null) { return(GetWiiButton(i.wii)); } #endif return(Input.GetButtonDown(i.keyboard)); } } Debug.LogWarning("Cannot find action: " + action); return(false); }
void Jump() { if (CnInputManager.GetButtonDown("Jump")) { StartCoroutine("JumpStop"); } }
void FixedUpdate() { if (Input.GetKey(KeyCode.RightArrow)) { direction = TankController.goDirection.right; } else if (Input.GetKey(KeyCode.LeftArrow)) { direction = TankController.goDirection.left; } else if (Input.GetKey(KeyCode.UpArrow)) { direction = TankController.goDirection.up; } else if (Input.GetKey(KeyCode.DownArrow)) { direction = TankController.goDirection.down; } else { direction = TankController.goDirection.stay; } MobileMove(); if (Input.GetKeyDown(KeyCode.Space) || CnInputManager.GetButtonDown("Jump")) { controller.Shoot(); } controller.direction = direction; }
private void Update() { if (!Jump) { Jump = CnInputManager.GetButtonDown("Jump"); } }
// Update is called once per frame void Update() { if (CnInputManager.GetButtonDown("Pause")) { Time.timeScale = 1.0f; gameObject.SetActive(false); } }
private void Update() { if (!m_Jump) { // Read the jump input in Update so button presses aren't missed. m_Jump = CnInputManager.GetButtonDown("Jump"); } }
//opens the level void OnTriggerStay2D(Collider2D col) { button.SetActive(true); if (CnInputManager.GetButtonDown("Fire1")) { SceneManager.LoadScene(levelName); } }
protected virtual void Update() { button?.SetActive(currentTime <= 0f); currentTime -= Time.deltaTime; if (CnInputManager.GetButtonDown("Ultra") && currentTime <= 0f) { Ult(); } }
void Update() { if (CnInputManager.GetButtonDown("Restart")) { StartCoroutine(go()); animt.SetTrigger("clicked"); AudioSource.PlayClipAtPoint(clickSound, transform.position); } }
private void Update() { // 왼쪽 키를 누르면 //if (Input.GetKeyDown(KeyCode.LeftControl)) if (CnInputManager.GetButtonDown("LaserFire")) { Shot(); // 발포 } }
private SpecialAbility GetAbility() { if (CnInputManager.GetButtonDown(ButtonName)) { return(ChosenAbility); } return(SpecialAbility.Nothing); }
// Update is called once per frame void Update() { if (CnInputManager.GetButtonDown("Cancel")) { //Application.Quit (); Time.timeScale = 0.0f; PausePanel.SetActive(true); } }
private void Update() { if (isOnGround && CnInputManager.GetButtonDown("Jump")) { rigidBody.AddForce(new Vector2(0, jumpForce)); playerAnim.SetBool("Ground", false); playerAudio.PlayOneShot(jumpAudioClip); } }
void Move() { CorectROT(); position = new Vector3(CnInputManager.GetAxis("Horizontal"), 0f, 0f); if (position.x > 0) { if (CnInputManager.GetButtonDown("Run")) { speed = run; Debug.Log(run); } else { // transform.rotation = Quaternion.Euler(0, 0, 0); speed = memor_speed; Debug.Log(memor_speed); } gameG.SetFloat("MoveX", position.x, 0.1f, Time.deltaTime); RandL = true; gameG.SetBool("RandL", RandL); } else if (position.x < 0) { if (CnInputManager.GetButtonDown("Run")) { speed = run; Debug.Log(run); } else { speed = memor_speed; Debug.Log(memor_speed); } gameG.SetFloat("MoveX", position.x, 0.1f, Time.deltaTime); RandL = false; gameG.SetBool("RandL", RandL); } else if (position.x == 0) { gameG.SetFloat("MoveX", position.x, 0.1f, Time.deltaTime); } if (CnInputManager.GetButtonUp("Jump") && isJump) { gameG.ResetTrigger("idle"); gameG.SetTrigger("Jump"); GetComponent <Rigidbody2D>().AddForce(new Vector2(0f, Jump), ForceMode2D.Impulse); } }