1
This commit is contained in:
46
Assets/Artists/Scripts/Entities/Melee/EntityMelee.cs
Normal file
46
Assets/Artists/Scripts/Entities/Melee/EntityMelee.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user