NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/AI/Conditional/BTChainTrigger.cs

37 lines
1.1 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using BehaviorDesigner.Runtime.Tasks;
2023-10-19 15:00:19 +08:00
using Gameplay.BT.Variables;
2023-08-22 19:08:45 +08:00
using Gameplay.Level;
2023-12-13 16:20:41 +08:00
using Gameplay.Unit;
2024-11-04 15:24:11 +08:00
using Framework;
2023-08-22 19:08:45 +08:00
namespace Code.Scripts.Gameplay.BT.Conditional
{
public class BTChainTrigger : BehaviorDesigner.Runtime.Tasks.Conditional
{
public SharedBattleInfo SharedBattleInfo;
private GameUnit _owner;
2024-11-04 15:24:11 +08:00
2023-08-22 19:08:45 +08:00
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
}
public override TaskStatus OnUpdate()
{
2024-11-06 14:22:53 +08:00
// 撤退型不主动召唤
if (_owner != null && IsNotFallBack() && SharedBattleInfo.Value.AttachAIName == LevelData.AttachAIType.ChainAI &&
2024-11-04 15:24:11 +08:00
SharedBattleInfo.Value.theChosenOneId != Constants.INVALID_UINT_ID)
2023-08-22 19:08:45 +08:00
{
2024-11-04 15:24:11 +08:00
return TaskStatus.Success;
2023-08-22 19:08:45 +08:00
}
2023-10-19 15:00:19 +08:00
2023-08-22 19:08:45 +08:00
return TaskStatus.Failure;
}
2024-11-06 14:22:53 +08:00
private bool IsNotFallBack()
{
return SharedBattleInfo.Value.AIName != LevelData.AIType.FallBackIntensifyAI &&
SharedBattleInfo.Value.AIName != LevelData.AIType.FallBackAI;
}
2023-08-22 19:08:45 +08:00
}
}