Add event publishing for inventory and combat interactions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using GameCore.Combat.Interfaces;
|
||||
using GameCore.Events;
|
||||
using GameCore.Input;
|
||||
|
||||
namespace GameCore.Combat.Effects;
|
||||
@@ -12,8 +13,11 @@ public class HitscanEffect(float range) : IEffect
|
||||
|
||||
if (input == null || weapon == null) return;
|
||||
|
||||
var targetPos = input.MuzzlePosition + input.MuzzleDirection * range;
|
||||
var hit = context.World.WorldQuery.Raycast(input.MuzzlePosition, targetPos, context.Owner);
|
||||
var fromPos = input.MuzzlePosition;
|
||||
var targetPos = fromPos + input.MuzzleDirection * range;
|
||||
var hit = context.World.WorldQuery.Raycast(fromPos, targetPos, context.Owner);
|
||||
|
||||
context.World.PublishEvent(new HitscanImpactEvent(context.Owner, fromPos, targetPos, hit));
|
||||
|
||||
if (hit.DidHit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user