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>();
|
|
|
|
|
|
|
|
|
|
public override void StartFiring(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target)
|
|
|
|
|
{
|
|
|
|
|
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;
|
2021-03-07 01:10:31 +00:00
|
|
|
p.Damage = item.Evaluate(data.Damage);
|
2021-02-06 15:29:04 +00:00
|
|
|
p.DamageType = data.DamageType;
|
|
|
|
|
_weapons.Add(item, p);
|
|
|
|
|
p.Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void StopFiring(EquippedItem item)
|
|
|
|
|
{
|
|
|
|
|
_weapons[item].Stop();
|
|
|
|
|
_weapons.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|