using System.Collections; using System.Collections.Generic; using BITKit; using Microsoft.Extensions.DependencyInjection; using Net.Project.B.Melee; using NodeCanvas.Framework; using UnityEngine; namespace Net.Project.B.NodeCanvas { public class MeleeTask : ActionTask { public BBParameter GameObject; public BBParameter ViewPosition; public BBParameter> IgnoreTags; public BBParameter Interval; private readonly IntervalUpdate _intervalUpdate = new(1); private IMeleeService _meleeService; private readonly MeleeData _meleeData = new() { Radius = 1, Damage = 5, }; protected override string OnInit() { _meleeService = BITApp.ServiceProvider.GetRequiredService(); if (IgnoreTags.isNoneOrNull is false) _meleeData.IgnoreTags.AddRange(IgnoreTags.value); return base.OnInit(); } protected override void OnExecute() { base.OnExecute(); _intervalUpdate.Interval = Interval.value; if (_intervalUpdate.AllowUpdate) { _meleeData.Initiator = GameObject.value.GetInstanceID(); _meleeData.StartPosition = ViewPosition.value.position; _meleeService.Add(_meleeData); } EndAction(); } } }