mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 11:27:14 +08:00
(client) feat:健康给予,路径优化,结算界面,商店界面 (#60)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
This commit is contained in:
@@ -4,14 +4,14 @@ using Managers;
|
||||
namespace AI
|
||||
{
|
||||
/// <summary>
|
||||
/// AI行为树叶子节点:让 SelfEntity 向最近的敌对实体攻击一次。
|
||||
/// AI行为树叶子节点:让 SelfEntity 向最近的敌对实体攻击一次。
|
||||
/// </summary>
|
||||
public class JobNode_AttackTarget : LeafNodeBase
|
||||
{
|
||||
private Entity.Entity _targetHostileEntity; // 目标敌对实体
|
||||
|
||||
/// <summary>
|
||||
/// 执行攻击最近敌对目标的逻辑。
|
||||
/// 执行攻击最近敌对目标的逻辑。
|
||||
/// </summary>
|
||||
/// <returns>行为树节点状态。</returns>
|
||||
protected override Status ExecuteLeafLogic()
|
||||
@@ -26,10 +26,8 @@ namespace AI
|
||||
Relation.Hostile);
|
||||
// 如果没有找到敌对目标,任务失败
|
||||
if (!hostileEntityRecord || !hostileEntityRecord.entity)
|
||||
{
|
||||
// Debug.Log($"[{SelfEntity.entityDef.defName}] 行为节点<攻击目标>: 未找到敌对目标。");
|
||||
return Status.Failure; // 没有敌人可攻击
|
||||
}
|
||||
|
||||
_targetHostileEntity = hostileEntityRecord.entity;
|
||||
}
|
||||
@@ -43,16 +41,14 @@ namespace AI
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
// 2. 设置攻击方向
|
||||
// 攻击方向是从 SelfEntity 指向目标实体
|
||||
SelfEntity.attackDirection = _targetHostileEntity.Position - SelfEntity.Position;
|
||||
// 3. 尝试攻击
|
||||
|
||||
var attackInitiated = SelfEntity.TryAttack();
|
||||
return attackInitiated ? Status.Success : Status.Failure;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置此攻击节点的所有内部状态。
|
||||
/// 重置此攻击节点的所有内部状态。
|
||||
/// </summary>
|
||||
public override void Reset()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user