1
This commit is contained in:
@@ -15,16 +15,27 @@ namespace BITKit.Entities
|
||||
|
||||
[Header(Constant.Header.Settings)]
|
||||
[SerializeField] private int damage=50;
|
||||
[SerializeField] private string[] ignoreTags;
|
||||
|
||||
|
||||
[SerializeReference, SubclassSelector, Inject(true)] private IMeleeService meleeService;
|
||||
[Inject(true)] private IEntityOverride entityOverride;
|
||||
private readonly IntervalUpdate disableMelee = new(0.64f);
|
||||
public override void OnStart()
|
||||
{
|
||||
UnityEntity.AddListener<int>("Melee", Melee);
|
||||
UnityEntity.AddListener<string>(AIAction);
|
||||
|
||||
unityAnimator[0].onStateEnter += OnStateEnter;
|
||||
|
||||
if (entityOverride is not null)
|
||||
{
|
||||
entityOverride.OnOverride += OnOverride;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOverride(bool obj)
|
||||
{
|
||||
disableMelee.Reset();
|
||||
}
|
||||
|
||||
private void OnStateEnter(string obj)
|
||||
@@ -51,6 +62,8 @@ namespace BITKit.Entities
|
||||
}
|
||||
private void Melee(int _damage)
|
||||
{
|
||||
if (entityOverride.IsOvering) return;
|
||||
if (disableMelee.AllowUpdateWithoutReset is false) return;
|
||||
var forward = Transform.forward;
|
||||
meleeService.Melee(new MeleeCommand()
|
||||
{
|
||||
@@ -59,7 +72,8 @@ namespace BITKit.Entities
|
||||
Force = forward * 128,
|
||||
Range = 1.6f,
|
||||
Damage = _damage,
|
||||
Forward = forward
|
||||
Forward = forward,
|
||||
IgnoreTags = ignoreTags,
|
||||
});
|
||||
unityAnimator.Play("Attack");
|
||||
//entity.Invoke(Constant.Animation.Play, "Melee");
|
||||
|
Reference in New Issue
Block a user