1
This commit is contained in:
@@ -1,27 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using BITFALL.Combat;
|
||||
using BITKit.Animations;
|
||||
using BITKit.Entities.Melee;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
public interface IEntityMelee
|
||||
{
|
||||
void Execute();
|
||||
}
|
||||
public class EntityMelee : EntityComponent
|
||||
[CustomType(typeof(IMeleeCombat))]
|
||||
public class EntityMelee : EntityComponent,IMeleeCombat
|
||||
{
|
||||
[SerializeField] private UnityAnimator unityAnimator;
|
||||
|
||||
[Header(Constant.Header.Settings)]
|
||||
public int damage=50;
|
||||
public bool singleTarget;
|
||||
[SerializeField] private int damage=50;
|
||||
|
||||
|
||||
[SerializeReference, SubclassSelector, Inject(true)] private IMeleeService meleeService;
|
||||
[Inject(true)] private IEntityOverride entityOverride;
|
||||
public override void OnStart()
|
||||
{
|
||||
entity.AddListener<int>("Melee", Melee);
|
||||
entity.AddListener<string>(AIAction);
|
||||
|
||||
unityAnimator[0].onStateEnter += OnStateEnter;
|
||||
}
|
||||
|
||||
private void OnStateEnter(string obj)
|
||||
{
|
||||
if(entityOverride is null)return;
|
||||
if (obj is "HitStun")
|
||||
{
|
||||
entityOverride.AddOverride(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityOverride.RemoveOverride(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AIAction(string actionName)
|
||||
{
|
||||
switch (actionName)
|
||||
@@ -40,7 +59,14 @@ namespace BITKit.Entities
|
||||
Range = 1.6f,
|
||||
Damage = _damage,
|
||||
});
|
||||
entity.Invoke(Constant.Animation.Play, "Melee");
|
||||
unityAnimator.Play("Attack");
|
||||
//entity.Invoke(Constant.Animation.Play, "Melee");
|
||||
}
|
||||
|
||||
public void Execute() => Melee(damage);
|
||||
public void HitStun()
|
||||
{
|
||||
unityAnimator.Play("HitStun");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user