37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using BehaviorDesigner.Runtime.Tasks;
|
|
using Gameplay.BT.Variables;
|
|
using Gameplay.Level;
|
|
using Gameplay.Unit;
|
|
using Framework;
|
|
|
|
namespace Code.Scripts.Gameplay.BT.Conditional
|
|
{
|
|
public class BTChainTrigger : BehaviorDesigner.Runtime.Tasks.Conditional
|
|
{
|
|
public SharedBattleInfo SharedBattleInfo;
|
|
private GameUnit _owner;
|
|
|
|
public override void OnStart()
|
|
{
|
|
_owner = GameUnitManager.instance.infightUnits.Search(SharedBattleInfo.Value.ownerID);
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
// 撤退型不主动召唤
|
|
if (_owner != null && IsNotFallBack() && SharedBattleInfo.Value.AttachAIName == LevelData.AttachAIType.ChainAI &&
|
|
SharedBattleInfo.Value.targetID != Constants.INVALID_UINT_ID)
|
|
{
|
|
return TaskStatus.Success;
|
|
}
|
|
|
|
return TaskStatus.Failure;
|
|
}
|
|
|
|
private bool IsNotFallBack()
|
|
{
|
|
return SharedBattleInfo.Value.AIName != LevelData.AIType.FallBackIntensifyAI &&
|
|
SharedBattleInfo.Value.AIName != LevelData.AIType.FallBackAI;
|
|
}
|
|
}
|
|
} |