/** * 控制角色从当前位置向指定位置跳跃 * * \param targetPosition 目标位置(全局坐标系) * \param throughStyle 通过方式,默认指定为向前跳跃 */ public void JumpToTarget(Vector3 targetPosition, PathSegmentThroughStyle throughStyle) { if (PathSegmentThroughStyle.JumpUp == throughStyle) { this.targetPosition = targetPosition + new Vector3(0, 0.02F, 0); multipleForwardSpeed = 1.0F; } else { this.targetPosition = targetPosition; multipleForwardSpeed = VectorMath.DistanceXZ(targetPosition, transform.position) / normalizedForwardDistance; multipleForwardSpeed = Mathf.Clamp(multipleForwardSpeed, 1.0F, MAX_SPEED_MULTIPLE); } switch (throughStyle) { case PathSegmentThroughStyle.JumpUp: animator.SetTrigger(PROPERTY_JUMPUP); break; case PathSegmentThroughStyle.JumpDown: animator.SetTrigger(PROPERTY_JUMPDOWN); break; default: animator.SetTrigger(PROPERTY_JUMPFORWARD); break; } this.throughStyle = throughStyle; isProcessing = true; finishedSign = false; }