using Cielonos.MainGame.Effects.Feedback; using SLSUtilities.General; using Unity.Mathematics; using UnityEngine; namespace Cielonos.MainGame.Characters { public partial class PlayerAnimationSubcontroller { public void SetupDash(Vector3 direction, bool isInputDirection, float length) { if (player.movementSc.canDash && player.movementSc.canDodge && !player.landMovementSc.isDashing && !player.landMovementSc.isDodging && player.movementSc.dodgeIntervalTimer <= 0f && fullBodyFuncAnimSm.Play("Dash")) { length = length < 0 ? player.attributeSm[CharacterAttribute.DashLength] : length; float dashMultiplier = length / fullBodyFuncAnimSm.collection["Dash"].variableCollection.GetVariable("RootMoveZ"); player.landMovementSc.dashMoveMultiplier = dashMultiplier; if (isInputDirection) { player.landMovementSc.TurnToInputDirection(direction); } else { player.landMovementSc.TurnToDirection(direction, 0f); } } } private void DashStart() { player.landMovementSc.isDashing = true; player.audioSc.PlayDashSound(); Vector3 playerForward = player.transform.forward.Flatten(); Vector3 cameraForward = player.viewSc.playerCamera.transform.forward.Flatten(); float forwardDot = Vector3.Dot(playerForward, cameraForward); //如果角色和相机的角度相差120度以上 //播放普通Dash反馈 //播放背向Dash反馈 player.feedbackSc.PlayFeedback(forwardDot < -0.5f ? "Dash_NoCameraRotation" : "Dash"); //player.renderSc.dashTrails.ForEach(ds => ds.active = true); //player.renderSc.dashTrails.ForEach(ds => ds.Restart()); DodgeSource defaultDodge = DodgeSource.Default(player); player.reactionSc.dodgeSm.ApplyDodge(defaultDodge); player.eventSm.onDashStart.Invoke(); player.eventSm.onDodgeStart.Invoke(); } private void DashEnd() { player.landMovementSc.isDashing = false; player.landMovementSc.dashMoveMultiplier = 1; player.landMovementSc.isSprinting = true; //player.renderSc.dashTrails.ForEach(ds => ds.active = false); player.reactionSc.dodgeSm.RemoveDodge("DefaultDodge"); float interval = player.attributeSm[CharacterAttribute.DodgeInterval]; if (interval > 0f) { player.movementSc.dodgeIntervalTimer = interval; } player.eventSm.onDashEnd.Invoke(); player.eventSm.onDodgeEnd.Invoke(); } } public partial class PlayerAnimationSubcontroller { public void SetupDodge(float length) { if (player.movementSc.canDodge && !player.landMovementSc.isDashing && !player.landMovementSc.isDodging && player.movementSc.dodgeIntervalTimer <= 0f && fullBodyFuncAnimSm.Play("Dodge")) { length = length < 0 ? player.attributeSm[CharacterAttribute.DodgeLength] : length; float dashMultiplier = length / fullBodyFuncAnimSm.collection["Dodge"].variableCollection.GetVariable("RootMoveZ"); player.landMovementSc.dashMoveMultiplier = dashMultiplier; // Dodge反馈将在DodgeStart中通过新Feedback系统统一处理 } } private void DodgeStart() { player.landMovementSc.isDodging = true; player.audioSc.PlayDashSound(); // 使用新Feedback系统播放Dodge反馈 player.feedbackSc.PlayFeedback("Dodge"); //player.renderSc.dashTrails.ForEach(ds => ds.active = true); //player.renderSc.dashTrails.ForEach(ds => ds.Restart()); DodgeSource defaultDodge = DodgeSource.Default(player); player.reactionSc.dodgeSm.ApplyDodge(defaultDodge); player.eventSm.onDodgeStart.Invoke(); } private void DodgeEnd() { player.landMovementSc.isDodging = false; player.landMovementSc.dashMoveMultiplier = 1; //player.renderSc.dashTrails.ForEach(ds => ds.active = false); player.reactionSc.dodgeSm.RemoveDodge("DefaultDodge"); float interval = player.attributeSm[CharacterAttribute.DodgeInterval]; if (interval > 0f) { player.movementSc.dodgeIntervalTimer = interval; } player.eventSm.onDodgeEnd.Invoke(); } } }