using System.Collections; using System.Collections.Generic; using System.Xml; using BITKit.Entities.Melee; using Unity.Mathematics; using UnityEngine; namespace BITKit.Entities { public interface IEntityMelee { void Execute(); } public class EntityMelee : EntityComponent { [Header(Constant.Header.Settings)] public int damage=50; public bool singleTarget; [SerializeReference, SubclassSelector, Inject(true)] private IMeleeService meleeService; public override void OnStart() { entity.AddListener("Melee", Melee); entity.AddListener(AIAction); } private void AIAction(string actionName) { switch (actionName) { case "Melee": break; } } private void Melee(int _damage) { meleeService.Melee(new MeleeCommand() { PlayerId = Entity.Id, Position = Transform.position + Vector3.up, Force = Transform.forward * 128, Range = 1.6f, Damage = _damage, }); entity.Invoke(Constant.Animation.Play, "Melee"); } } }