This commit is contained in:
CortexCore
2023-10-20 19:31:12 +08:00
parent 5cd094ed9a
commit a160813262
1878 changed files with 630581 additions and 4485 deletions

View File

@@ -0,0 +1,46 @@
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<int>("Melee", Melee);
entity.AddListener<string>(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");
}
}
}