|
|
@@ -29,6 +29,7 @@ public class chargeDownward : MonoBehaviour
|
|
|
|
|
|
[LabelText("冷却时间")]
|
|
|
public float breakDuration = 0.5f;
|
|
|
+ private float breakEndDuration = 1.4f;
|
|
|
|
|
|
[LabelText("冲刺方向")]
|
|
|
public Vector3 dashDirection = Vector3.down;
|
|
|
@@ -60,6 +61,7 @@ public class chargeDownward : MonoBehaviour
|
|
|
|
|
|
private Vector3 riseStartPosition; // 记录上升起始位置,用于计算相对高度
|
|
|
private float breakStartTime; // 冷却开始时间
|
|
|
+ private float breakEndStartTime;
|
|
|
|
|
|
private Vector3 targetVelocity = Vector3.zero;
|
|
|
|
|
|
@@ -167,7 +169,6 @@ public class chargeDownward : MonoBehaviour
|
|
|
dashSpeed *= targetRiseHeight/Height;
|
|
|
riseSpeed *= 1+(targetRiseHeight / Height-1)/2f;
|
|
|
}
|
|
|
- owner.ani.speed = 3.33f / breakDuration;
|
|
|
owner.ani.Play("attack_fall", 0, 0);
|
|
|
IsDashing = false;
|
|
|
isBreaking = true;
|
|
|
@@ -190,8 +191,7 @@ public class chargeDownward : MonoBehaviour
|
|
|
|
|
|
riseStartPosition = transform.position; // 记录上升起点
|
|
|
IsRising = true;
|
|
|
- owner.ani.speed = 1f;
|
|
|
- owner.ani.Play("walk", 0, 0);
|
|
|
+ owner.ani.Play("idle", 0, 0);
|
|
|
|
|
|
Vector3 direction = useLocalSpace ? transform.TransformDirection(riseDirection) : riseDirection;
|
|
|
if (direction.y < 0) direction.y = -direction.y; // 确保向上
|
|
|
@@ -227,12 +227,16 @@ public class chargeDownward : MonoBehaviour
|
|
|
|
|
|
private void UpdateBreaking()
|
|
|
{
|
|
|
- if (!isBreaking) return;
|
|
|
-
|
|
|
- if (Time.time - breakStartTime >= breakDuration)
|
|
|
+ if (Time.time - breakStartTime >= breakDuration && isBreaking)
|
|
|
{
|
|
|
+ owner.ani.Play("attack_end", 0, 0);
|
|
|
+ breakEndStartTime = Time.time;
|
|
|
isBreaking = false;
|
|
|
- currentState = MovementState.Idle;
|
|
|
+ Debug.Log("休息结束");
|
|
|
+ }
|
|
|
+ if (Time.time - breakEndStartTime >= breakEndDuration && !isBreaking)
|
|
|
+ {
|
|
|
+ currentState = MovementState.Idle;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -252,7 +256,6 @@ public class chargeDownward : MonoBehaviour
|
|
|
rb.velocity = Vector3.right * findSpeed * direction;
|
|
|
if (Mathf.Abs(cloestX - x)<0.1)
|
|
|
{
|
|
|
- Debug.Log("寻找成功");
|
|
|
rb.velocity = Vector3.zero;
|
|
|
cloest = null;
|
|
|
isFind = false;
|