Files
Cielonos/docs/闪避反馈系统设计.md
2026-04-18 13:57:19 -04:00

702 lines
20 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Cielonos 闪避系统摄像机反馈设计方案
## 一、现有系统分析
### 1.1 反馈系统架构
```
FeedbackManager
FeedbackPlayer运行时播放器
FeedbackDataScriptableObject - 包含多个Track
FeedbackTrack轨道 - 并行播放)
FeedbackClip片段 - 包含FeedbackAction
FeedbackActionBase具体的反馈动作
├── CameraRotationShakeAction ✓
├── CameraFieldOfViewAction ✓
├── CameraPositionShakeAction ✓
├── RadialBlurAction ✓
├── VignetteAction ✓
├── TimeScaleModifierAction ✓
├── ChromaticAberrationAction ✓
└── ... 其他后处理效果
```
### 1.2 闪避系统架构
```
DodgeSubmodule
├── DodgeSource[](闪避源列表)
│ ├── dodgeTime闪避持续时间
│ ├── perfectTime完美闪避窗口0.2秒)
│ ├── isPerfectDodging是否处于完美闪避中
│ └── 回调方法
└── 方法
├── ApplyDodge()
├── RemoveDodge()
├── PerfectDodge() → 触发"PerfectDodge"反馈
└── NormalDodge() → 触发"NormalDodge"反馈
PlayerAnimationSubcontroller
├── SetupDash() → 触发"Dash"反馈
└── SetupDodge() → 触发"Dodge"反馈
```
### 1.3 现有的闪避反馈
`DodgeSource.Default()` 工厂方法中,已经预设了:
- **PerfectDodge** 触发:
- `MMF_RadialBlur` - 径向模糊
- `MMF_AdvancedVignette` - 高级暗角
- **Dash/Dodge** 触发:
- `MMF_CinemachineRotation` - 旋转震动
- `MMF_RadialBlur` - 径向模糊
---
## 二、闪避反馈设计方案
### 2.1 普通闪避Dash & Dodge的摄像机反馈
#### 设计目标
- **Dash冲刺**:强调速度感、移动感、动态感
- **Dodge后撤步**:强调突然性、灵活性、敏捷感
#### Dash冲刺的反馈设计
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **FOV变化** | +8° → 0°0.3秒) | 冲刺时视野扩大,增强速度感 |
| **旋转震动** | X:2° Y:1° Z:3°0.2秒) | 轻微旋转,增加动态感 |
| **径向模糊** | 中心扩散0.25秒) | 运动模糊效果,增强速度感知 |
| **色调(可选)** | 轻微偏蓝0.2秒) | 冷色调增强速度感 |
#### Dodge后撤步的反馈设计
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **FOV变化** | +5° → 0°0.2秒) | 轻微扩大比Dash弱 |
| **旋转震动** | X:1° Y:0.5° Z:1.5°0.15秒) | 比Dash更轻微 |
| **径向模糊** | 中心扩散0.15秒) | 比Dash更短促 |
| **色调(可选)** | 轻微偏青0.15秒) | 青色增强灵活感 |
### 2.2 完美闪避Perfect Dodge的摄像机反馈
#### 设计目标
- **强调**:时机感、成就感、满足感
- **核心**:时间扭曲 + 视觉强化 + 中心聚焦
#### Perfect Dodge 的完整反馈设计
##### 1. 时间扭曲效果
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **时间缩放** | 0.3x → 1.0x0.3秒) | 瞬间慢动作,然后快速恢复 |
| **曲线** | 先慢后快EaseInOut | 自然恢复 |
##### 2. 中心聚焦效果
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **暗角强化** | 强度 0.5 → 0.20.4秒) | 聚焦中心,增强紧张感 |
| **暗角中心** | 偏移到攻击来源方向 | 视觉引导 |
| **色调偏移** | 轻微偏蓝0.2秒) | 冷色调增强冷静感 |
##### 3. 运动模糊效果
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **径向模糊强化** | 中心到边缘0.2秒) | 强烈的速度感 |
| **模糊强度** | 0.8 → 0.00.3秒) | 快速衰减 |
##### 4. 色散效果
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **色差Chromatic Aberration** | RGB分离 0.3 → 0.00.25秒) | 增强视觉冲击 |
| **分离中心** | 攻击来源方向 | 动态分离 |
##### 5. 相机震动
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **旋转震动** | X:3° Y:2° Z:5°0.3秒) | 比普通闪避更强 |
| **震动曲线** | QuickImpact快速冲击 | 即时峰值,快速衰减 |
##### 6. 屏幕特效
| 效果类型 | 参数配置 | 说明 |
|---------|---------|------|
| **屏幕闪光** | 中心白闪光0.1秒) | 瞬间高亮 |
| **Bloom强化** | 强度+0.50.2秒) | 增强发光效果 |
#### 完美闪避反馈时间线
```
时间(秒): 0.0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
─────────────────────────────────────────────────────────────────
时间缩放 ████▓▒▒░░░░
0.3x → 1.0x
FOV ▓▓▓▒▒░░░░░
+8° → 0°
径向模糊 ██████▓▒░░░
强度0.8 → 0.0
暗角 ▓▓▓▓▓▒▒░░░
强度0.5 → 0.2
色差 ████████░░░
分离0.3 → 0.0
屏幕闪光 ██░░░░░░░░░
瞬间
相机震动 █████▓▒░░░░
3°旋转
```
---
## 三、需要创建/完善的反馈组件
### 3.1 现有组件(可直接使用)
| 组件 | 状态 | 用途 |
|------|------|------|
| CameraRotationShakeAction | ✅ 已存在 | 相机旋转震动 |
| CameraFieldOfViewAction | ✅ 已存在 | FOV变化 |
| CameraPositionShakeAction | ✅ 已存在 | 相机位置震动 |
| RadialBlurAction | ✅ 已存在 | 径向模糊 |
| VignetteAction | ✅ 已存在 | 暗角效果 |
| ChromaticAberrationAction | ✅ 已存在 | 色差效果 |
| TimeScaleModifierAction | ✅ 已存在 | 时间缩放 |
### 3.2 需要创建的新组件
#### 1. MotionBlurAction运动模糊
**优先级**P0 - 必须
**功能**
- 控制运动模糊效果SpeedLines或MotionBlur后处理
- 支持模糊强度、方向、中心点控制
**参数**
```csharp
public class MotionBlurAction : CurveShakeAction
{
public bool modifyDirection; // 是否修改方向
public Vector2 direction; // 模糊方向
public bool modifyStrength; // 是否修改强度
public float strengthMin; // 最小模糊强度
public float strengthMax; // 最大模糊强度
public bool modifySamples; // 是否修改采样数
public int samplesMin; // 最小采样数
public int samplesMax; // 最大采样数
}
```
#### 2. ScreenFlashAction屏幕闪光
**优先级**P1 - 重要
**功能**
- 控制屏幕中心的白闪光效果
- 支持颜色、强度、衰减速度控制
**参数**
```csharp
public class ScreenFlashAction : FeedbackActionBase
{
[Title("Flash Settings")]
public Color flashColor = Color.white;
public float maxIntensity = 1.0f;
public AnimationCurve fadeCurve; // 衰减曲线
public bool useCenterOffset; // 是否使用中心偏移
public Vector2 centerOffset; // 中心偏移
public bool affectBloom; // 是否影响Bloom
public float bloomIntensity = 0.5f;
}
```
#### 3. ColorGradeAction色调调整
**优先级**P2 - 可选
**功能**
- 动态调整画面色调
- 支持色温、色调、对比度调整
**参数**
```csharp
public class ColorGradeAction : FeedbackActionBase
{
public bool modifyTemperature; // 是否修改色温
public float temperatureMin; // 冷色调(负值)
public float temperatureMax; // 暖色调(正值)
public bool modifyTint; // 是否修改色调
public Color tintColor; // 色调颜色
public bool modifySaturation; // 是否修改饱和度
public float saturationOffset; // 饱和度偏移
}
```
#### 4. SpeedLinesAction速度线
**优先级**P1 - 重要
**功能**
- 控制屏幕边缘的速度线效果
- 增强速度感和动态感
**参数**
```csharp
public class SpeedLinesAction : CurveShakeAction
{
[Title("Speed Lines Settings")]
public bool modifyCount; // 是否修改线条数量
public int countMin; // 最小线条数
public int countMax; // 最大线条数
public bool modifyLength; // 是否修改线条长度
public float lengthMin; // 最小长度
public float lengthMax; // 最大长度
public bool modifyOpacity; // 是否修改不透明度
public float opacityMin; // 最小不透明度
public float opacityMax; // 最大不透明度
public bool modifyCenter; // 是否修改中心
public Vector2 center; // 中心点
}
```
---
## 四、实现计划
### 4.1 Phase 1: 普通闪避反馈1天
#### 目标
实现 Dash 和 Dodge 的基本摄像机反馈
#### 任务
1. [ ] **创建/配置 Dash FeedbackData**
- 名称:`DodgeDash`
- Track 1: "Camera" - CameraFieldOfViewAction
- FOV: +8° → 0°0.3秒)
- Track 2: "Camera" - CameraRotationShakeAction
- Rotation: (2°, 1°, 3°)
- Curve: SmoothBump
- Track 3: "PostProcess" - RadialBlurAction
- Intensity: 0.3 → 0.00.25秒)
2. [ ] **创建/配置 Dodge FeedbackData**
- 名称:`DodgeBackstep`
- Track 1: "Camera" - CameraFieldOfViewAction
- FOV: +5° → 0°0.2秒)
- Track 2: "Camera" - CameraRotationShakeAction
- Rotation: (1°, 0.5°, 1.5°)
- Curve: QuickImpact
- Track 3: "PostProcess" - RadialBlurAction
- Intensity: 0.2 → 0.00.15秒)
3. [ ] **修改 PlayerAnimationSubcontroller**
- SetupDash() 使用新的"DodgeDash" FeedbackData
- SetupDodge() 使用新的"DodgeBackstep" FeedbackData
4. [ ] **测试调整**
- 根据实际效果调整参数
- 确保Dash和Dodge有明显区别
### 4.2 Phase 2: 完美闪避反馈1-2天
#### 目标
实现 Perfect Dodge 的特殊摄像机反馈
#### 任务
1. [ ] **创建 ScreenFlashAction如果尚未实现**
- 屏幕中心白闪光
- 快速衰减
2. [ ] **创建 MotionBlurAction如果尚未实现**
- 运动模糊效果
- 支持方向和强度控制
3. [ ] **创建/配置 Perfect Dodge FeedbackData**
- 名称:`PerfectDodge`
- Track 1: "Time" - TimeScaleModifierAction
- Mode: Dynamic
- Curve: Custom0.3x → 1.0x
- Duration: 0.3秒
- Track 2: "Camera" - CameraFieldOfViewAction
- FOV: +8° → 0°0.3秒)
- Track 3: "Camera" - CameraRotationShakeAction
- Rotation: (3°, 2°, 5°)
- Curve: QuickImpact
- Duration: 0.3秒
- Track 4: "PostProcess" - VignetteAction
- Intensity: 0.5 → 0.20.4秒)
- 中心偏移到攻击来源
- Track 5: "PostProcess" - RadialBlurAction
- Intensity: 0.8 → 0.00.3秒)
- Track 6: "PostProcess" - ChromaticAberrationAction
- Intensity: 0.3 → 0.00.25秒)
- Track 7: "Effect" - ScreenFlashAction
- Color: White
- Intensity: 1.0 → 0.00.1秒)
- Track 8: "Effect" - BloomEnhanceAction可选
- Intensity: +0.50.2秒)
4. [ ] **修改 DodgeSource.Default() 工厂方法**
- 更新 PerfectDodge 回调逻辑
- 确保所有反馈正确触发
5. [ ] **测试调整**
- 调整时间曲线
- 确保慢动作效果明显
- 优化视觉效果
### 4.3 Phase 3: 优化和细节1天
#### 目标
完善细节,提升品质
#### 任务
1. [ ] **添加速度线效果SpeedLines**
- 冲刺时显示速度线
- 增强速度感
2. [ ] **添加色调调整(可选)**
- Dash: 冷色调(蓝)
- Dodge: 青色(青绿)
- Perfect Dodge: 偏蓝
3. [ ] **创建编辑器预览工具**
- 在Editor中预览闪避效果
- 快速调整参数
4. [ ] **性能优化**
- 确保反馈系统不会造成性能问题
- 优化后处理效果
5. [ ] **创建反馈预设库**
- Dash_Powerful强力冲刺
- Dash_Light轻盈冲刺
- Dodge_Quick快速后撤
- Dodge_Strong强力后撤
- PerfectDodge_Time时间扭曲型
- PerfectDodge_Impact冲击型
---
## 五、参数配置建议
### 5.1 Dash冲刺
```csharp
// DodgeDash FeedbackData
{
// FOV
FOV Offset: +8°
FOV Duration: 0.3s
FOV Curve: EaseOut
// Rotation Shake
Rotation: (2°, 1°, 3°)
Duration: 0.2s
Curve: SmoothBump
// Radial Blur
Intensity: 0.3
Duration: 0.25s
Center: Dynamic (player screen position)
}
```
### 5.2 Dodge后撤步
```csharp
// DodgeBackstep FeedbackData
{
// FOV
FOV Offset: +5°
FOV Duration: 0.2s
FOV Curve: EaseOut
// Rotation Shake
Rotation: (1°, 0.5°, 1.5°)
Duration: 0.15s
Curve: QuickImpact
// Radial Blur
Intensity: 0.2
Duration: 0.15s
Center: Dynamic (player screen position)
}
```
### 5.3 Perfect Dodge
```csharp
// PerfectDodge FeedbackData
{
// Time Scale
Time Scale: 0.3x 1.0x
Duration: 0.3s
Curve: EaseInOut
// FOV
FOV Offset: +10°
FOV Duration: 0.4s
FOV Curve: EaseOut
// Rotation Shake
Rotation: (3°, 2°, 5°)
Duration: 0.3s
Curve: QuickImpact
// Vignette
Intensity: 0.5 0.2
Duration: 0.4s
Center Offset: Attack direction
// Radial Blur
Intensity: 0.8 0.0
Duration: 0.3s
Center: Dynamic
// Chromatic Aberration
Intensity: 0.3 0.0
Duration: 0.25s
// Screen Flash
Color: White
Intensity: 1.0 0.0
Duration: 0.1s
}
```
---
## 六、实现建议
### 6.1 创建流程
1. **创建 FeedbackData**
-`Resources/Feedbacks/` 目录下创建
- 命名为 `DodgeDash.asset`, `DodgeBackstep.asset`, `PerfectDodge.asset`
2. **配置 FeedbackTracks**
- 为每个效果创建独立的 Track
- 建议 Track 命名:
- "Camera" - 相机相关效果
- "PostProcess" - 后处理效果
- "Effect" - 特殊效果
- "Time" - 时间控制
3. **添加 FeedbackClips**
- 在每个 Track 中添加 Clip
- 配置时间范围
- 选择对应的 FeedbackAction
4. **配置 FeedbackAction 参数**
- 根据设计文档调整参数
- 使用预设曲线
- 设置正确的持续时间
5. **在代码中引用**
-`PlayerAnimationSubcontroller` 中引用 FeedbackData
-`DodgeSource` 中配置 PerfectDodge 回调
### 6.2 代码修改建议
#### DodgeSource.Default() 工厂方法修改
```csharp
public static DodgeSource Default(CharacterBase sourceCharacter, float duration = Mathf.Infinity)
{
DodgeSource defaultDodge = new DodgeSource(
sourceCharacter, null, "DefaultDodge", 0,
"NormalDodge", "PerfectDodge", duration, 0.2f
);
if (sourceCharacter is Player player)
{
// 普通闪避反馈
defaultDodge.onNormalDodge = () =>
{
// 可以根据闪避类型Dash/Dodge播放不同的反馈
// player.feedbackSc["NormalDodge"].Play();
};
// 完美闪避反馈
defaultDodge.onPerfectDodge = () =>
{
// 更新效果中心点
var radialBlur = player.feedbackSc["PerfectDodge"].feedback
.GetFeedbackOfType<RadialBlurAction>();
if (radialBlur != null)
{
radialBlur.modifyCenter = true;
radialBlur.center = player.GetNormalizedScreenPosition();
}
var vignette = player.feedbackSc["PerfectDodge"].feedback
.GetFeedbackOfType<VignetteAction>();
if (vignette != null)
{
vignette.modifyCenter = true;
vignette.center = player.GetNormalizedScreenPosition();
}
// 播放完美闪避反馈
player.feedbackSc["PerfectDodge"].Play();
Debug.Log("Perfect Dodge!");
};
}
return defaultDodge;
}
```
#### PlayerAnimationSubcontroller 修改
```csharp
// SetupDash() 中
public void SetupDash(Vector3 direction, bool isInputDirection, float length)
{
if (player.movementSc.canDash && player.movementSc.canDodge &&
fullBodyFuncAnimSm.Play("Dash"))
{
length = length < 0 ? player.attributeSm["DashLength"] : length;
float dashMultiplier = length / fullBodyFuncAnimSm.collection["Dash"]
.variableCollection.GetVariable<float>("RootMoveZ");
player.landMovementSc.dashMoveMultiplier = dashMultiplier;
// 根据方向计算相机旋转
Vector3 cameraForward = player.viewSc.playerCamera.transform.forward.Flatten();
Vector3 dashCameraRotation;
if (isInputDirection)
{
player.landMovementSc.TurnToInputDirection(direction);
Vector3 playerForward = player.transform.forward.Flatten();
dashCameraRotation = CalculateDashAngles(playerForward, cameraForward);
}
else
{
player.landMovementSc.TurnToDirection(direction, 0f);
dashCameraRotation = CalculateDashAngles(direction, cameraForward);
}
// 配置动态参数
var rotationShake = player.feedbackSc["DodgeDash"].feedback
.GetFeedbackOfType<CameraRotationShakeAction>();
if (rotationShake != null)
{
rotationShake.directionSettings.targetDirection = direction;
}
// 播放 Dash 反馈
player.feedbackSc["DodgeDash"].Play();
}
}
// SetupDodge() 中
public void SetupDodge(float length)
{
if (player.movementSc.canDodge && fullBodyFuncAnimSm.Play("Dodge"))
{
length = length < 0 ? player.attributeSm["DodgeLength"] : length;
float dashMultiplier = length / fullBodyFuncAnimSm.collection["Dodge"]
.variableCollection.GetVariable<float>("RootMoveZ");
player.landMovementSc.dashMoveMultiplier = dashMultiplier;
// 配置动态参数
var rotationShake = player.feedbackSc["DodgeBackstep"].feedback
.GetFeedbackOfType<CameraRotationShakeAction>();
if (rotationShake != null)
{
rotationShake.directionSettings.targetDirection = -player.transform.forward.Flatten();
}
// 播放 Dodge 反馈
player.feedbackSc["DodgeBackstep"].Play();
}
}
```
---
## 七、测试清单
### 7.1 功能测试
- [ ] Dash 反馈正常播放
- [ ] Dodge 反馈正常播放
- [ ] Perfect Dodge 反馈正常播放
- [ ] 所有效果平滑过渡
- [ ] 无视觉抖动或撕裂
- [ [ ] 时间缩放正常工作
- [ ] 后处理效果正常工作
### 7.2 性能测试
- [ ] 60 FPS 稳定运行
- [ ] 无内存泄漏
- [ ] Feedback 实例正确回收
- [ ] 后处理效果不影响性能
### 7.3 体验测试
- [ ] Dash 速度感明显
- [ ] Dodge 突然性明显
- [ ] Perfect Dodge 成就感强烈
- [ ] 效果与动作匹配
- [ ] 反馈强度适中(不晕眩)
---
## 八、后续优化方向
### 8.1 高级功能
1. **动态反馈强度**
- 根据冲刺距离调整反馈强度
- 根据完美闪避时机早晚调整强度
2. **连闪避加成**
- 连续完美闪避时增强反馈
- 视觉上越来越夸张
3. **敌人攻击适配**
- 根据攻击类型调整反馈
- 重攻击有更强的反馈
### 8.2 辅助功能
1. **难度设置**
- 新手模式:增强反馈提示
- 高手模式:减少辅助反馈
2. **无障碍选项**
- 减少运动模糊
- 减少时间缩放
- 减少屏幕效果
---
*文档生成日期: 2026-04-17*
*生成者: Game Designer Agent*