巡逻节点未移动时重新设置移动

main
yurui 2024-06-14 15:23:55 +08:00
parent 19bf5f3086
commit dc50bcf513
1 changed files with 9 additions and 5 deletions

View File

@ -28,16 +28,20 @@ namespace Code.Scripts.Gameplay.BT.Task
public override TaskStatus OnUpdate()
{
if(SharedBattleInfo.Value.PartolPointIndex != _lastTargetPointIndex && !AIUtils.IsNeedStop(_owner))
if (SharedBattleInfo.Value.PartolPointIndex != _lastTargetPointIndex && !AIUtils.IsNeedStop(_owner))
{
_lastTargetPointIndex = SharedBattleInfo.Value.PartolPointIndex;
_TargetCellIndex = LevelManager.Instance.CurrentLevel.Map.BlockPosition2TGSCellIndex(SharedBattleInfo.Value.PatrolInfos[SharedBattleInfo.Value.PartolPointIndex].patrolPoint);
_owner.MoveTo(_TargetCellIndex, false);
return TaskStatus.Running;
}
else if(_owner.transData.cellIndex == _TargetCellIndex)
{
return TaskStatus.Success;
}
if (_owner.transData.cellIndex == _TargetCellIndex)
return TaskStatus.Success;
if (!_owner.statusData.isMoveing) // 没有移动表示路径错误,被控制,被阻挡,需要重新设置移动
_lastTargetPointIndex = -1;
return TaskStatus.Running;
}
}