Files
zeling_v2/Assets/_Game/Scripts/Enemies/EnemyMoveInput.cs
Joywayer bcd8b0e90b feat: Update enemy AI and movement systems
- Enhanced Physics2D layer collision report with new interactions between Player and Enemy layers.
- Refactored BD_InvestigateLastKnown to streamline animation handling and improve readability.
- Simplified BD_MaintainCombatDistance by consolidating movement stop logic.
- Updated BD_MoveToPlayer to set AI phase on start.
- Improved BD_Patrol logic with better handling of stuck states and path failures.
- Enhanced BD_PatrolWaypoints to manage stuck conditions and retry logic more effectively.
- Refined BD_ReturnToHome to remove unnecessary animation calls.
- Updated BD_WalkRandom to ensure AI phase is set correctly on start.
- Improved EnemyAbilityBase to delegate target facing to the movement system.
- Enhanced EnemyBase with new movement methods for better control.
- Refactored EnemyMovement to introduce a new input system for handling movement and facing.
- Added EnemyMoveInput struct to encapsulate movement intentions.
- Updated Physics2DSettings to reflect new layer collision matrix.
- Introduced RTK CLI instructions for optimized command usage.
2026-05-29 17:01:59 +08:00

39 lines
1.7 KiB
C#
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.
using UnityEngine;
namespace BaseGames.Enemies
{
/// <summary>
/// 敌人移动意图信号。
/// <para><b>持久字段</b><see cref="MoveDir"/>/<see cref="MoveSpeed"/>):写入后持续生效,
/// 解决 FixedUpdate 频率快于 Update 时的空帧抖动;由 <see cref="WantStop"/> 显式清零。</para>
/// <para><b>一次性脉冲字段</b><see cref="WantStop"/>/<see cref="WantFace"/>
/// EnemyMovement 消费后自动清零,无需 BD 任务每帧续写。</para>
/// </summary>
public struct EnemyMoveInput
{
/// <summary>
/// 水平移动方向:-1 左 / +1 右。<b>持久</b>——写入后保持,直到 WantStop 被置 true 或
/// 再次写 0。不写 = 维持上一次方向(不会自动停止)。
/// </summary>
public float MoveDir;
/// <summary>显式移动速度。0 = 使用配置中的 WalkSpeed。<b>持久</b>,随 MoveDir 同步清零。</summary>
public float MoveSpeed;
/// <summary>
/// 一次性脉冲:置 true 后 EnemyMovement 立即停止并将 MoveDir/MoveSpeed 清零,
/// 然后自动将本字段清零。BD 任务在 OnEnd() 中调用 StopMovement() 即可,无需每帧续写。
/// </summary>
public bool WantStop;
/// <summary>一次性脉冲:本 FixedUpdate 帧处理朝向对准后自动清零。</summary>
public bool WantFace;
/// <summary>朝向目标的世界坐标WantFace 为 true 且 FaceDir == 0 时生效)。</summary>
public Vector2 FaceTargetPos;
/// <summary>直接指定朝向方向:+1 右 / -1 左 / 0 表示由 FaceTargetPos 计算。</summary>
public int FaceDir;
}
}