feat: add hero target
This commit is contained in:
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Service
|
||||
{
|
||||
public class NpcHandler : EntityHandler<NPC>
|
||||
public class NpcHandler : EntityHandler<NPC>, EventHandlerInterface<TargetChangedEvent>
|
||||
{
|
||||
public override void OnCreate(NPC entity)
|
||||
{
|
||||
@ -23,6 +23,16 @@ namespace Client.Domain.Service
|
||||
eventBus.Publish(new CreatureDeletedEvent(entity.Id));
|
||||
}
|
||||
|
||||
public void Handle(TargetChangedEvent @event)
|
||||
{
|
||||
var target = GetEntity(@event.Hero.TargetId);
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@event.Hero.Target = target;
|
||||
}
|
||||
|
||||
public NpcHandler(EntityFactoryInterface<NPC> factory, EventBusInterface eventBus, NpcInfoHelperInterface npcInfoHelper) : base(factory)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
|
Reference in New Issue
Block a user