Aetheria/Assets/Scripts/Gameplay/Weapons/HitscanManager.cs
2026-07-05 19:36:19 +01:00

23 lines
817 B
C#

using UnityEngine;
public class HitscanManager : InstantWeaponEffectManager
{
public Prototype Prototype;
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target)
{
var p = Prototype.Instantiate<HitscanEffect>();
p.SourceEntity = source.Entity;
p.ZoneRenderer = source.ZoneRenderer;
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
var barrel = source.GetBarrel(hp);
var t = p.transform;
t.SetParent(barrel, false);
t.localRotation = Quaternion.identity;
t.localPosition = Vector3.zero;
// t.position = barrel.position;
// t.forward = barrel.forward;
p.Range = weapon.Range;
p.ImpactIntensity = 1;
p.Fire();
}
}