2021-02-06 15:29:04 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class ConstantParticleWeaponManager : ConstantWeaponEffectManager
|
|
|
|
|
{
|
|
|
|
|
public Prototype WeaponPrototype;
|
|
|
|
|
|
|
|
|
|
private Dictionary<EquippedItem, ConstantParticleWeapon> _weapons = new Dictionary<EquippedItem, ConstantParticleWeapon>();
|
|
|
|
|
|
2026-06-14 17:43:42 +01:00
|
|
|
public override void StartFiring(ConstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target)
|
2021-02-06 15:29:04 +00:00
|
|
|
{
|
|
|
|
|
var p = WeaponPrototype.Instantiate<ConstantParticleWeapon>();
|
|
|
|
|
p.Source = source;
|
|
|
|
|
p.Target = target;
|
|
|
|
|
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
|
|
|
|
var barrel = source.GetBarrel(hp);
|
|
|
|
|
var t = p.transform;
|
|
|
|
|
t.SetParent(barrel);
|
|
|
|
|
t.forward = barrel.forward;
|
|
|
|
|
t.position = barrel.position;
|
2026-06-14 17:43:42 +01:00
|
|
|
p.Damage = weapon.Damage;
|
|
|
|
|
p.DamageType = weapon.DamageType;
|
2026-06-21 09:37:54 +01:00
|
|
|
p.Range = weapon.Range;
|
2021-02-06 15:29:04 +00:00
|
|
|
_weapons.Add(item, p);
|
|
|
|
|
p.Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void StopFiring(EquippedItem item)
|
|
|
|
|
{
|
|
|
|
|
_weapons[item].Stop();
|
|
|
|
|
_weapons.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|