Added heat variation option for Performance Stats Ability to toggle radiators on/off using H key Item durability loss (Wear) is now heat dependent and incurred only when used Restricted equip/unequip to docked (inactive) entities Fixed race condition causing exceptions in database sync code
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ConstantLaserManager : ConstantWeaponEffectManager
|
|
{
|
|
public Prototype LaserPrototype;
|
|
|
|
private Dictionary<EquippedItem, ConstantLaser> _lasers = new Dictionary<EquippedItem, ConstantLaser>();
|
|
|
|
public override void StartFiring(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target)
|
|
{
|
|
var p = LaserPrototype.Instantiate<ConstantLaser>();
|
|
p.SourceEntity = source.Entity;
|
|
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
|
var barrel = source.GetBarrel(hp);
|
|
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item);
|
|
var t = p.transform;
|
|
t.SetParent(barrel);
|
|
t.forward = barrel.forward;
|
|
t.position = barrel.position;
|
|
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
|
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item);
|
|
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item);
|
|
p.DamageType = data.DamageType;
|
|
_lasers.Add(item, p);
|
|
}
|
|
|
|
public override void StopFiring(EquippedItem item)
|
|
{
|
|
_lasers[item].Stop();
|
|
_lasers.Remove(item);
|
|
}
|
|
}
|