private void Jump() { if (input.GetKeyDown(Key.Jump)) { //地面にいるときはそのままジャンプ if (is_Landing) { _jump.Jump(); } //地面から離れている時 else { //数フレーム前に地面にいた時はジャンプする if (leave_Land_Frame_Count < 3) { _jump.Jump(); leave_Land_Frame_Count = 3; } //ボタン押下後数フレーム間着地しないか監視する else { start_Jump_Frame_Count = true; jump_Frame_Count = 0; } } } //ボタン押下後数フレーム以内に着地したときジャンプする if (start_Jump_Frame_Count) { jump_Frame_Count++; if (is_Landing && jump_Frame_Count < 10) { _jump.Jump(); start_Jump_Frame_Count = false; jump_Frame_Count = 0; } } //地面から離れた後のフレームカウントする if (is_Landing) { leave_Land_Frame_Count = 0; } else { leave_Land_Frame_Count++; } //減速 if (!input.GetKey(Key.Jump)) { _jump.Release_Jumping(); } }
//通常時の操作 private void Normal_Controlle() { //移動 if (Input.GetAxisRaw("Horizontal") > 0) { _transition.Transition(1); } else if (Input.GetAxisRaw("Horizontal") < 0) { _transition.Transition(-1); } else { _transition.Slow_Down(); } //ジャンプ if (input.GetKey(Key.Jump) && is_Landing) { _jump.Jump(); } if (input.GetKeyUp(Key.Jump)) { _jump.Slow_Down(); } //近接攻撃 Attack(); //カブトムシに乗る if (input.GetKeyDown(Key.Ride) && BeetlePowerManager.Instance.Get_Beetle_Power() > 0) { _getting_On_Beetle.Get_On_Beetle(true); } }
private void Update() { //Collect keyboard inputs at the start of each update loop _dirInputX = Input.GetAxisRaw("Horizontal"); //Left/Right _dirInputY = Input.GetAxisRaw("Vertical"); //Up/Down _jumpKeyState = (Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.Space)); //Jump _dashKeyState = Input.GetKey(KeyCode.LeftShift); //Dash _atkKeyState = Input.GetKey(KeyCode.X); //Attack _specialKeyState = Input.GetKey(KeyCode.C); //Special (Bounce Bomb) //Jumping //Only true when jump key is pressed, which is then sent to PlayerJump script _jumping.Jump(_jumpKeyState, false, _dirInputX); _slideJump.SlideJump(_jumpKeyState, _dirInputX); //Movement //Sends single float value -1, 0, or 1 to PlayerMovement script _movement.Move(_dirInputX); //Dash //Only triggers when LeftShift is pressed, which then sends current directional input to PlayerDash script _dash.Dash(_dashKeyState, _dirInputX, _atkKeyState); if (_dirInputY != -1) { //Attack _attack.Attack(_atkKeyState, _dashKeyState); } //Ground Pound _groundPound.GroundPound(_atkKeyState, _dirInputY); //PaintBomb _paintBomb.ThrowBomb(_specialKeyState, _dirInputY); }
private void Update() { if (!stunned) { //float translation = Input.GetAxis(_Joystick) * moveSpeed; float translation = Input.GetAxis("Horizontal") * moveSpeed; if (translation < 0) { _playerAttack.ChangeHitbox("left"); } else if (translation > 0) { _playerAttack.ChangeHitbox("right"); } translation *= Time.deltaTime; transform.position += new Vector3(translation, 0, 0); _playerJump.Jump(jump); _playerAttack.Attack(punch); } if (stunned) { if (t == null) { t = Timer.StartNew(gameObject, 1f, ChangeStun); } } }
// Update is called once per fixed time delta void FixedUpdate() { /* * This is from Joystic of standard assest * var moveRequest = CrossPlatformInputManager.GetAxis("Horizontal"); * var jumpRequest = CrossPlatformInputManager.GetAxis("Vertical"); */ // this is from Joystick from SimpleInput system var moveRequest = SimpleInput.GetAxis("Horizontal"); var jumpRequest = SimpleInput.GetAxis("Vertical"); if (playerMoveScript != null && playerMoveScript.isActiveAndEnabled) { playerMoveScript.Move(moveRequest); } if (playerJumpScript != null && playerJumpScript.isActiveAndEnabled) { playerJumpScript.Jump(jumpRequest); } if (playerJetJumpScript != null && playerJetJumpScript.isActiveAndEnabled) { playerJetJumpScript.Jump(jumpRequest); } if (playerFlyScript != null && playerFlyScript.isActiveAndEnabled) { playerFlyScript.Fly(moveRequest, jumpRequest); } }
public void Jump(InputAction.CallbackContext context) { if (CanJump) { if (context.started) { PlayerJump.ResetJumpCharge(); IsJumpCharging = true; BoardFX.SetCrouching(true); PlayerEvents.Instance.StartJumpCharge(); IsJumping = true; } else if (context.canceled && IsJumping && IsJumpCharging) { PlayerJump.Jump(); PlayerJump.StartLandingBuffer(); BoardFX.PlayJumpJetParticles(); PlayerJump.ResetJumpCharge(); IsJumpCharging = false; BoardFX.SetCrouching(false); PlayerEvents.Instance.Jump(); } } else if (context.canceled) { PlayerEvents.Instance.HandleJumpAfterAim(); IsJumpCharging = false; } }
private IEnumerator JumpNextFrame(Vector3 dir, bool applyThisForce = false, float force = 1, float boost = 1) { yield return(new WaitForEndOfFrame()); Debug.Log("ici le boost: " + boost); playerJump.Jump(dir, true, force, boost); }
void Update() { if (Input.GetKeyDown(KeyCode.W) && !Input.GetKeyDown(KeyCode.D) && !Input.GetKeyDown(KeyCode.E)) { //LOOK UP bulletSide = 0; } if (!Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.D)) { pm.Movement(1); if (!rightSide && Input.GetKeyDown(KeyCode.D)) { rightSide = !rightSide; fc.Flip(); } bulletSide = 1; //walking animation } if (Input.GetKeyDown(KeyCode.W) && Input.GetKeyDown(KeyCode.D)) { //LOOK DIAGONALr //SHOOT DIAGONALr } if (!Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.A)) { pm.Movement(-1); if (rightSide && Input.GetKeyDown(KeyCode.A)) { rightSide = !rightSide; fc.Flip(); } bulletSide = 1; //walking animation } if (Input.GetKeyDown(KeyCode.W) && Input.GetKeyDown(KeyCode.A)) { //LOOK DIAGONALl //SHOOT DIAGONALl } if (Input.GetKeyDown(KeyCode.Q)) { pj.Jump(); //jump animation } if (Input.GetKeyDown(KeyCode.E)) { bs.Shoot(bulletSide); //shooting animation } }
private void UpdateDropkick() { if (Input.GetKeyDown(props.keybindings.dropkickKey) && jump.OnGround && CanDropkick) { _isDropkicking = true; hasKicked = false; jump.Jump(); rb.velocity += new Vector2(movement.MovementInput.x, 1) * settings.dropkickBoost; } }
void FixedUpdate() { playerInput.GetKeyInput(); combinedVelocity = Vector3.zero; if (activePlayer == ActivePlayer.Cube && cubeDashLaunch.dashLaunchUnlocked && cubeDashLaunch.canDashLaunch) { combinedVelocity.y = cubeDashLaunch.DashLaunch(); } else if (activePlayer == ActivePlayer.Cube && cubeDash.dashUnlocked && cubeDash.isDashing) { combinedVelocity = (cubeDash.moveToSpot - rb.position) * cubeDash.speedMultiplier; } else if (activePlayer == ActivePlayer.Sphere && sphereBounce.slamBounceUnlocked && sphereBounce.canSlamBounce) { combinedVelocity.y = sphereBounce.SlamBounce(); } else if (activePlayer == ActivePlayer.Sphere && sphereSlam.slamUnlocked && !playerGroundDetection.isGrounded && (sphereSlam.isSlaming || sphereSlam.isSlamPaused)) { if (sphereSlam.isSlaming) { combinedVelocity = Vector3.down * sphereSlam.slamSpeed * 10; } else if (sphereSlam.isSlamPaused) { combinedVelocity = Vector3.zero; } } else { combinedVelocity.x = playerMove.Move(); combinedVelocity.y = playerJump.Jump(); if (!playerGroundDetection.isGrounded && rb.useGravity && combinedVelocity.y == 0) { combinedVelocity.y = playerJump.Fall(); } if (cubeWallJump.wallJumpUnlocked) { if (activePlayer == ActivePlayer.Cube && cubeWallJump.wallContact && !playerGroundDetection.isGrounded && cubeWallJump.wallJumpInput) { combinedVelocity = cubeWallJump.WallJump(); } else if (cubeWallJump.currWallJumpVelocity != Vector2.zero && cubeWallJump.dragH > 0 && cubeWallJump.dragV > 0) { combinedVelocity += cubeWallJump.WallJumpFall(); } } } //playerMove.Turn(); combinedVelocity.z = 0; rb.velocity = combinedVelocity; }
// Update is called once per frame void Update() { if (m_availlableJumps != m_jumps && m_playerJump.m_isGrounded) { m_availlableJumps = m_jumps; } if (!m_playerJump.m_isGrounded && Input.GetButtonDown("Jump") && m_availlableJumps != 0) { m_playerJump.Jump(m_jumpForce); m_availlableJumps--; } }
/// <summary> /// ici jump, mais just après la frame qui fait buggé /// </summary> /// <returns></returns> private IEnumerator JumpNextFrame(Vector3 dir, bool applyThisForce = false, float force = 0, float boost = 1) { yield return(new WaitForEndOfFrame()); if (!playerJump.CoolDownJump.IsReady()) { yield break; } playerJump.PrepareAndJump(dir); externalForce.SetBigMass(); //set sa propre mass big ! playerController.PlayersManager.Jump(playerController.IdPlayer); playerJump.Jump(dir, applyThisForce, force, boost); }
/// <summary> /// ici effectue un dernier jump quand c'est fini /// </summary> public void EndJump(Vector3 endDir) { externalForce.CoolDownDontApplyGravity.StartCoolDown(timerStunGravity); Debug.Log("here endJump ?"); Debug.DrawRay(transform.position, endDir * littleForceAtTheEnd, Color.cyan, 1f); if (endDir == Vector3.zero) { return; } playerJump.Jump(endDir, true, littleForceAtTheEnd, 1); //Debug.Break(); }
public void Jump() { if (isCrouching) { ToggleCrouch(); } else if (playerJump.CanJump() && !playerAim.IsAiming) { var force = playerJump.IsGrounded() ? jumpForce : airJumpForce; rigidBody.AddForce(transform.up * force, ForceMode.Impulse); playerJump.Jump(); animator.SetTrigger(PlayerAnimationTags.JUMP_TRIGGER); AudioManager.Instance.PlayJumpAudio(transform.position); } }
private void playerInput() { //Movement playerMovement.Horizontal = InputManager.MovementInput.x; playerMovement.Vertical = InputManager.MovementInput.y; playerMovement.Move(rigid); //Jump if (objectGroundCheck.Grounded) { if (InputManager.Key_Space) { playerJump.Jump(rigid); } } }
void Update() { if (Input.GetKeyDown(KeyCode.UpArrow) && !Input.GetKeyDown(KeyCode.RightArrow) && !Input.GetKeyDown(KeyCode.LeftArrow)) { //LOOK UP bulletSide = 0; } if (!Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.RightArrow)) { pm.Movement(1); if (!rightSide && Input.GetKeyDown(KeyCode.RightArrow)) { rightSide = !rightSide; fc.Flip(); } bulletSide = 1; //walking animation } if (!Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.LeftArrow)) { pm.Movement(-1); if (rightSide && Input.GetKeyDown(KeyCode.LeftArrow)) { rightSide = !rightSide; fc.Flip(); } bulletSide = 1; //walking animation } if (Input.GetKeyDown(KeyCode.Semicolon)) { pj.Jump(); //jump animation } if (Input.GetKeyDown(KeyCode.RightShift)) { bs.Shoot(bulletSide); //shooting animation } }
/// <summary> /// フレーム更新処理 /// </summary> void IState.Update() { // ジャンプボタンが押されたら if (character.IsJumpStart == true) { // ジャンプ playerJump.Jump(); // 空中状態に移行 character.AerialStart(); } // アクションボタンが押されたら if (character.IsSlideStart == true) { // 手すりをつかむ猶予時間 var catchSliderTime = playerSlide.catchSliderTime; // 手すりヒット判定 playerSlide.RayTimerStart(catchSliderTime); } // 地面から落ちたら if (character.IsGround == false) { // 空中状態に移行 character.AerialStart(); } // 弾に当たったら if (playerAttack.IsHit == true) { // ダウン状態に移行 character.Down(); } // アタックボタンが押されたら if (character.IsAttack == true) { playerAttack.Attack(); } // ブーストのキー入力を確認 playerCharge.BoostKeyCheck(); }
void CheckInput(float timer) { //タッチかどうか float dis = Vector3.Distance(touchStartPos, touchEndPos); if (dis / timer > 200f && !isJumpInOneTouch) { playerJump.Jump(); isJumpInOneTouch = true; } if (dis / timer < 100f) { Shot(); Debug.Log("aaaaaaa"); //フリックかな? //上向きかな?? } // else if (dis > 30f && (touchEndPos - touchStartPos).y >0) { // playerJump.Jump (); // } }
/// <summary> /// jump ! dans la direction donné /// </summary> public bool TryToAirJump(Vector3 dir) { if (!CanJump()) { return(false); } //PlayerConnected.Instance.setVibrationPlayer(playerController.IdPlayer, onAirJump); //set vibration de saut Debug.Log("air jump !"); Debug.DrawRay(transform.position, -Vector3.up, Color.red, 5f); GameObject particle = ObjectsPooler.Instance.SpawnFromPool(GameData.PoolTag.ParticleBump, transform.position, Quaternion.identity, ObjectsPooler.Instance.transform); particle.transform.rotation = QuaternionExt.LookAtDir(-Vector3.up); currentAirJump++; coolDownBetween2AirJump.StartCoolDown(); playerJump.Jump(dir, true, airJumpForce); return(true); }
private void Update() { //Throws hitbox detection in "front" of player instead of downward to allow for wall sliding. _touchingFront = Physics2D.OverlapCircle(_front.position, checkRadius, _groundLayer); //If player's "front" is against a wall, slow down fall velocity. //Fall velocity can be changed in Unity Inspector with _wallSlidingSpeed parameter if (_touchingFront == true && _dirInput != 0) { _rigidBody.velocity = new Vector2(_rigidBody.velocity.x, Mathf.Clamp(_rigidBody.velocity.y, -_wallSlidingSpeed, float.MaxValue)); _isSliding = true; } else { _isSliding = false; } if (_isSliding == true && _jumpKey == true) { _jumping.Jump(_jumpKey, _isSliding, _dirInput); } }
private void Update() { if (!stunned) { translation = Input.GetAxis(_joystick) * moveSpeed; //translation = Input.GetAxis("Horizontal") * moveSpeed; if (translation < 0) { _playerAttack.ChangeHitbox("left"); } else if (translation > 0) { _playerAttack.ChangeHitbox("right"); } translation *= Time.deltaTime; transform.position += new Vector3(translation, 0, 0); _playerJump.Jump(jump); _playerAttack.Attack(punch); } if (stunned) { if (t == null) { t = Timer.StartNew(gameObject, 1f, ChangeStun); } } if (shielded) { if (t == null) { shield = Instantiate(shield, new Vector2(transform.position.x, transform.position.y), Quaternion.identity); t = Timer.StartNew(gameObject, 5f, ChangeShielded); } shield.transform.position = transform.position; } }
/// <summary> /// フレーム更新処理 /// </summary> void IState.Update() { // ジャンプボタンが押されたら if (character.IsJumpStart == true) { // 空中状態に移行 character.AerialStart(); // ジャンプ playerJump.Jump(); // ブーストのキー入力を確認 playerCharge.BoostKeyCheck(); return; } // 着地したら if (character.IsGround == true) { // ラン状態に移行 character.RunStart(); // ブーストのキー入力を確認 playerCharge.BoostKeyCheck(); return; } // ショットボタンが押されたら if (character.IsAttack == true) { playerAttack.Attack(); } // 弾に当たったら if (playerAttack.IsHit == true) { // ダウン状態に移行 character.Down(); } // ブーストのキー入力を確認 playerCharge.BoostKeyCheck(); }
/// <summary> /// フレーム更新処理 /// </summary> void IState.Update() { // 手すりの上にいるかのチェック処理 playerSlide.SlideCheck(); // アクションボタンが押されたら if (character.IsSlideEnd == true) { // y方向への慣性制限 playerSlide.LimitInertiaY(); // 空中状態に移行 character.RunStart(); } // if(character.IsSlideEnd) // ジャンプボタンが押されたら if (character.IsJumpStart == true) { // y方向への慣性制限 playerSlide.LimitInertiaY(); // ジャンプ playerJump.Jump(); // 空中状態に移行 character.AerialStart(); } // if(character.IsJumpStart) // 弾に当たったら if (playerAttack.IsHit == true) { // キャラの傾きを戻す transform.rotation = Quaternion.identity; // y方向への慣性制限 playerSlide.LimitInertiaY(); // ダウン状態に移行 character.Down(); } // ブーストのキー入力を確認 playerCharge.BoostKeyCheck(); } // Do
private void Update() { //Collect keyboard inputs at the start of each update loop _dirInput = Input.GetAxisRaw("Horizontal"); //Left/Right _jumpKeyState = Input.GetKey(KeyCode.Z); //Jump _dashKeyState = Input.GetKey(KeyCode.LeftShift); //Dash _atkKeyState = Input.GetKey(KeyCode.X); //Attack //Jumping //Only true when jump key is pressed, which is then sent to PlayerJump script _jumping.Jump(_jumpKeyState, false, _dirInput); //Movement //Sends single float value -1, 0, or 1 to PlayerMovement script _movement.Move(_dirInput); //Dash //Only triggers when LeftShift is pressed, which then sends current directional input to PlayerDash script _dash.Dash(_dashKeyState, _dirInput, _atkKeyState); //Attack _attack.Attack(_atkKeyState, _dashKeyState); }
void KeyDownAction(KeyCode key) { switch (key) { case KeyCode.A: case KeyCode.D: playerAnimation.Play("IsRun", true); break; case KeyCode.Space: playerAnimation.Play("IsJump", true); if (isGrounded) { playerJump.Jump(jumpPower); } break; case KeyCode.F: int dir = direction.Direction == EDirection.LEFT ? -1 : 1; playerFlash.FlashMove(dir, moveSpeed); break; } }
void FixedUpdate() { IsOnGround(); IsCeiling(); playerSlopeMove.SlopeCheck(); jetpack.Fly(jetpack.FlySpeed); jetpack.FlyRotation(jetpack.RotationSpeed, jetpack.NormalizeRotationSpeed); jetpack.Fuel = jetpack.SetFuel(jetpack.Fuel); ChooseMoveType(); ChooseState(); NewVelocity = playerMovement.Move(rb, playerSlopeMove.slopeNormalPerp); playerJump.Jump(); if (playerStates.curMoveType == PlayerStates.MoveType.SlopeMove && Mathf.Abs(rb.velocity.x) > 1f) { PlayerGravity(playerSlopeMove.hitGround); } else { PlayerGravity(Vector2.up); } }
private void Update() { myIsJumping = myPlayerInput.IsJumping(); myIsQuitting = myPlayerInput.IsQuitting(); myHasCollided = myPlayerCollision.HasCollided(); if (myIsQuitting) { Application.Quit(); } if (myHasCollided) { myPlayerCollision.ResetCollided(); myCamera.TriggerShake(myShakeDurationRocks, myShakeMagnitudeRocks); if (!myGrounded && myAirMovement.y < 0) { myPlayerJump.Bounce(ref myAirMovement, myJumpForce); return; } myPlayerDeath.Die(); myCurrentSpeed = myBaseSpeed; mySplineManager.ResetAllSplines(); ResetSpline(); } if (myGrounded) { myPlayerBobbing.Bob(); if (myIsJumping) { myPlayerJump.Jump(myCurrentPoints, myPointsIndex, myJumpForce, myCurrentSpeed, ref myAirMovement); ResetSpline(); return; } if (!myPlayerSpline.SplineMovement(myCurrentPoints, ref myCurrentSpeed, ref myPointsIndex, ref mySplineT, myGravity, myBoost)) { myPlayerSpline.ReleaseSpline(myCurrentPoints, myCurrentSpeed, ref myAirMovement, myPointsIndex); ResetSpline(); } return; } myPlayerAir.AirMovement(myGravity, ref myAirMovement); if (myIsJumping) { myPlayerBackflip.Backflip(myFlipRotationSpeed); } else { myPlayerAir.AirRotation(myRotationResetSpeed); } if (myAirMovement.y < 0) { if (myPlayerSpline.AttemptToCatchSpline(mySplineManager, myReach, ref myTooCloseToOldSpline, ref myPointsIndex, ref myCurrentPoints, ref myOldPoints, ref myBoost)) { myCamera.TriggerShake(myShakeDurationSplines, myShakeMagnitudeSplines); myGrounded = true; mySplineT = 0; } } }
public void Jump() { PlayerState = PlayerState.Jump; _jump.Jump(); }
public void Jump() { jump.Jump(); }
private void Jumping(bool jumpState) { playerJump.Jump(jumpState); }