巡逻节点未移动时重新设置移动
parent
19bf5f3086
commit
dc50bcf513
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue