This commit is contained in:
CortexCore
2023-10-24 23:37:59 +08:00
parent 325f63d6bc
commit 3e39e627bc
388 changed files with 29043 additions and 889 deletions

View File

@@ -30,6 +30,7 @@ namespace BITFALL.Melee
private static readonly Queue<MeleeCommand> Queue = new();
public static void Melee(MeleeCommand command)=>Queue.Enqueue(command);
[SerializeField] private LayerMask detectLayer;
[SerializeReference, SubclassSelector] private IDamageService damageService;
private void Awake()
{
Singleton = this;
@@ -52,17 +53,24 @@ namespace BITFALL.Melee
}
damaged.Add(damageable.Entity);
damageable.GiveDamage(new DamageMessage()
var damageMsg =
new DamageMessage()
{
initiator = UnityEntitiesService.Get(command.PlayerId) as IEntity,
damageType = new MeleeDamageMessage
Initiator = UnityEntitiesService.Get(command.PlayerId) as IEntity,
DamageType = new MeleeDamageMessage
{
},
target = damageable.Entity,
damage = command.Damage is 0 ? 64 : command.Damage,
hit = damageable,
});
Target = damageable.Entity,
Damage = command.Damage is 0 ? 64 : command.Damage,
Hit = damageable,
};
if (command.PlayerId !=default)
{
damageMsg.Initiator = UnityEntitiesService.Get(command.PlayerId) as IEntity;
}
damageService.Execute(damageMsg);
damageable.Rigidbody.AddForceAtPositionAsync(command.Force, command.Position, ForceMode.Impulse)
.Forget();