} // Do /// <summary> /// 物理挙動用のフレーム更新処理 /// </summary> void IState.FixedUpdate() { // 手すりから離れたら var rayHit = playerSlide.RayHit; if (rayHit == false) { // y方向への慣性制限 playerSlide.LimitInertiaY(); // 手すり後のジャンプ猶予状態に移行 character.AfterSlideStart(); } // 滑走処理 playerSlide.Slide(); // 接地判定 hitChecker.GroundCheckSlider(); //// 地面についたら if (character.IsGround == true) { // キャラの傾きを戻す transform.rotation = Quaternion.identity; // ラン状態に移行 character.RunStart(); } }
void Update() { if (Time.timeScale != 0 && !states.isPossessing) { if (!states.dontMoveX && !states.isSliding && !states.isGrabbed) { movement.SetVelocityX(Input.GetAxis("Horizontal"), true); } if (Input.GetButtonDown("X") && states.isCloseToGround) { if (states.isSliding) { movement.SetVelocityY(1.7f / 2f, false); } else { movement.SetVelocityY(1.7f, false); } } else if (Input.GetButtonDown("X") && states.isGrabbed) { states.dontMoveX = true; states.isGrabbed = false; movement.SetVelocityX(-states.direction, false); movement.SetVelocityY(1.7f, false); dontGrabWallTimer = dontGrabWallDelay; } else if (Input.GetButtonDown("X") && !states.hasAirJumped && !states.isSliding) { movement.SetVelocityY(1.7f, false); states.hasAirJumped = true; states.dontMoveX = false; } if (dontGrabWallTimer <= 0) { if (Input.GetButton("R1") && states.isTouchingWallInFront && !states.isSliding && !states.isGrabbed && !states.isTouchingGround && states.isColliderUpright) { wallGrab.GrabWall(); } } else { dontGrabWallTimer -= Time.unscaledDeltaTime; } if (Input.GetButtonUp("R1") && states.isGrabbed) { states.isGrabbed = false; } if (Input.GetButtonDown("R2") && states.isCloseToGround && !states.isSliding && !states.isGrabbed) { slide.Slide(); } if (Input.GetButtonDown("L1") && !states.isSliding && !states.hasTeleported && !states.isPreparingTeleport) { teleport.PrepareTeleport(); } if (Input.GetButtonDown("R1") && Input.GetAxis("Vertical") < 0) { spawnBlock.SpawnBlock(); } if (Input.GetButtonDown("L2")) { spawnDecoy.SpawnDecoy(); } if (Input.GetButton("Square")) { if (possessionInputTimer <= 0) { Debug.Log("Looking for target..."); possession.LookForTarget(); } else { Debug.Log("Charging possession..."); possessionInputTimer -= Time.deltaTime; } } if (Input.GetButtonUp("Square")) { possession.Possession(); } } }