private bool isUnstoppable = false;//冲刺时是否有伤害 public void SetTargetPosition(Vector2 position) { Vector2 temp = player.transform.position; targetPosition = position - temp; if (targetPosition.magnitude > windThunderDistance)//冲刺最长距离为7 { targetPosition.Normalize(); targetPosition *= windThunderDistance; } movement.SetGravity(false); if (movement.IsFacingLeft()) { targetPosition.x = -targetPosition.x; } //isUnstoppable = true; }
public void RocketPackClock() { if (isOn) { velocityVector = rigid.velocity; if (movementComponent.IsFacingLeft()) { velocityVector.x -= (velocityVector.x < 0 ? speedUpRocketForce : slowdownRocketForce) * Time.deltaTime; //forceVector.x = -rocketForce; velocityVector.x = velocityVector.x < -rocketMaxSpeed ? -rocketMaxSpeed : velocityVector.x; } else { velocityVector.x += (velocityVector.x > 0 ? speedUpRocketForce : slowdownRocketForce) * Time.deltaTime; velocityVector.x = velocityVector.x > rocketMaxSpeed ? rocketMaxSpeed : velocityVector.x; } rigid.velocity = velocityVector; if (velocityVector.x > 3 && playerDetector.isRightTouchingGround() || velocityVector.x < -3 && playerDetector.isLeftTouchingGround()) { movementComponent.RequestChangeControlStatus(borkeDownStunTime, MovementPlayer.PlayerControlStatus.Interrupt); isOn = false; curTime = 0f; rigid.velocity = Vector2.zero; rocketPackObject.SetActive(false); } curTime += Time.deltaTime; if (curTime >= rocketTotalTime) { isOn = false; curTime = 0f; rigid.velocity = Vector2.zero; rocketPackObject.SetActive(false); } } }