using System.Collections; using System.Collections.Generic; using System.Data.Common; using System.Linq; using System.Runtime.Remoting; using BITKit; using BITKit.Entities; using BITKit.UX; using Cysharp.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Net.Project.B.Interaction; using NodeCanvas.Framework; using Project.B.Map; using UnityEngine; namespace Net.Project.B.NodeCanvas { public class WorldInteractionTask : ActionTask { public BBParameter worldObject; protected override void OnExecute() { if (worldObject.isNull) { EndAction(false); Debug.LogWarning("agent为null"); return; } var entitiesService = BITApp.ServiceProvider.GetRequiredService(); if (entitiesService.TryGetEntity(worldObject.value.GetInstanceID(), out var entity) is false) { Debug.LogWarning("entity为null"); EndAction(false); return; } if (entity.ServiceProvider.GetService() is not { } interactable) { Debug.LogWarning("interactable为null"); EndAction(false); return; } var interactionService = BITApp.ServiceProvider.GetRequiredService(); var player = entitiesService.QueryComponents(); interactionService.Interaction(player.Length > 0 ? player[0].Item1:this, interactable, WorldInteractionProcess.System); EndAction(); } } }