2024-09-18 14:38:27 +08:00
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
|
using Gameplay.BT.Variables;
|
2024-12-17 15:32:55 +08:00
|
|
|
using Gameplay.Unit;
|
2024-09-18 14:38:27 +08:00
|
|
|
|
|
|
|
|
public class BTAutoFight : Conditional
|
|
|
|
|
{
|
|
|
|
|
public SharedBattleInfo SharedBattleInfo;
|
2024-12-17 15:32:55 +08:00
|
|
|
private GameUnit _owner;
|
|
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
|
{
|
|
|
|
|
_owner = GameUnitManager.instance.infightUnits.Search(SharedBattleInfo.Value.ownerId);
|
|
|
|
|
}
|
2024-09-18 14:38:27 +08:00
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
|
{
|
2024-12-17 15:32:55 +08:00
|
|
|
if (_owner.commonData.canControl) return TaskStatus.Failure;
|
2024-09-18 14:38:27 +08:00
|
|
|
return SharedBattleInfo.Value.AutoFight
|
|
|
|
|
? TaskStatus.Success
|
|
|
|
|
: TaskStatus.Failure;
|
|
|
|
|
}
|
|
|
|
|
}
|