2023-08-22 19:08:45 +08:00
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
|
using Framework;
|
2023-10-19 15:00:19 +08:00
|
|
|
using Gameplay.AI;
|
2023-08-22 19:08:45 +08:00
|
|
|
using Gameplay.BT.Variables;
|
|
|
|
|
using Gameplay.Common;
|
2023-12-13 16:20:41 +08:00
|
|
|
using Gameplay.Unit;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
namespace Code.Scripts.Gameplay.BT.Task
|
|
|
|
|
{
|
|
|
|
|
public class BTMoveAway : Action
|
|
|
|
|
{
|
|
|
|
|
public SharedBattleInfo SharedBattleInfo;
|
|
|
|
|
private GameUnit _owner;
|
|
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
|
{
|
2023-12-14 18:25:52 +08:00
|
|
|
_owner = GameUnitManager.instance.infightUnits.Search(SharedBattleInfo.Value.ownerId);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
if (_owner != null)
|
|
|
|
|
{
|
2023-10-19 15:00:19 +08:00
|
|
|
DebugUtil.Log("BT move away start, owner: {0}",_owner?.GetID());
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
|
{
|
2023-10-19 15:00:19 +08:00
|
|
|
if (SharedBattleInfo.Value.theChosenOneId != Constants.INVALID_UINT_ID && !AIUtils.IsNeedStop(_owner))
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2023-12-14 18:25:52 +08:00
|
|
|
_owner?.MoveAway(GameUnitManager.instance.infightUnits.Search(SharedBattleInfo.Value.theChosenOneId));
|
2023-08-22 19:08:45 +08:00
|
|
|
DebugUtil.LogG($"BT move away update success, owner: {_owner?.GetID()}, target: {SharedBattleInfo.Value.theChosenOneId}");
|
2023-10-19 15:00:19 +08:00
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
return TaskStatus.Success;
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|