2021-02-05 03:21:15 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
|
|
|
|
|
public class ConstantLightningManager : ConstantWeaponEffectManager
|
|
|
|
|
{
|
|
|
|
|
public Prototype LightningPrototype;
|
|
|
|
|
|
|
|
|
|
private Dictionary<EquippedItem, ConstantLightning> _bolts = new Dictionary<EquippedItem, ConstantLightning>();
|
|
|
|
|
|
|
|
|
|
public override void StartFiring(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target)
|
|
|
|
|
{
|
|
|
|
|
var p = LightningPrototype.Instantiate<ConstantLightning>();
|
|
|
|
|
p.Source = source;
|
|
|
|
|
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
|
|
|
|
var barrel = source.GetBarrel(hp);
|
|
|
|
|
p.Barrel = barrel;
|
2021-03-07 01:10:31 +00:00
|
|
|
p.Damage = item.Evaluate(data.Damage);
|
|
|
|
|
p.Range = item.Evaluate(data.Range);
|
|
|
|
|
p.Penetration = item.Evaluate(data.Penetration);
|
|
|
|
|
p.Spread = item.Evaluate(data.DamageSpread);
|
2021-02-05 03:21:15 +00:00
|
|
|
p.DamageType = data.DamageType;
|
|
|
|
|
_bolts.Add(item, p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void StopFiring(EquippedItem item)
|
|
|
|
|
{
|
|
|
|
|
_bolts[item].Stop();
|
|
|
|
|
_bolts.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|