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

33 lines
924 B
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
{
2024-11-04 15:24:11 +08:00
/// <summary>
///
/// </summary>
2023-08-22 19:08:45 +08:00
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-04 15:24:11 +08:00
if (_owner != null && SharedBattleInfo.Value.AttachAIName == LevelData.AttachAIType.ChainAI &&
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;
}
}
}