48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
using BehaviorDesigner.Runtime.Tasks;
|
|
using Gameplay.BT.Variables;
|
|
using Gameplay.Character;
|
|
using Gameplay.Unit;
|
|
using Gameplay.AI;
|
|
using Framework;
|
|
|
|
namespace Code.Scripts.Gameplay.AI.Task
|
|
{
|
|
/// <summary>
|
|
/// 召唤连锁组内的友军
|
|
/// </summary>
|
|
public class BTSendChainActive : Action
|
|
{
|
|
public SharedBattleInfo SharedBattleInfo;
|
|
private GameUnit _owner;
|
|
|
|
/// <summary>
|
|
/// 上一个目标
|
|
/// </summary>
|
|
private uint _lastTarget;
|
|
|
|
public override void OnStart()
|
|
{
|
|
_owner = GameUnitManager.instance.infightUnits.Search(SharedBattleInfo.Value.ownerId);
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
if (_owner != null && SharedBattleInfo.Value.theChosenOneId != Constants.INVALID_UINT_ID && _lastTarget != SharedBattleInfo.Value.theChosenOneId)
|
|
{
|
|
_lastTarget = SharedBattleInfo.Value.theChosenOneId;
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_CHARACTER_AI_GROUPCHAIN,
|
|
new EventDataSpecialAI
|
|
{
|
|
owner = _owner,
|
|
friendsInOwnerSight = AIUtils.FindFriendsInSightDistance(_owner),
|
|
target = SharedBattleInfo.Value.theChosenOneId,
|
|
groups = SharedBattleInfo.Value.groupInfo,
|
|
});
|
|
// DebugUtil.LogError("AI :{0} 发送了组连锁事件,目标是:{1}", _owner.GetID(), SharedBattleInfo.Value.theChosenOneId);
|
|
return TaskStatus.Running;
|
|
}
|
|
|
|
return TaskStatus.Failure;
|
|
}
|
|
}
|
|
} |