Restore the stable legacy Unity project
This commit is contained in:
parent
56a156ee87
commit
7006a6b0dd
2070 changed files with 180490 additions and 169303 deletions
34
Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs
Normal file
34
Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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 = item.Evaluate(data.Range);
|
||||
var t = p.transform;
|
||||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = item.Evaluate(data.Damage);
|
||||
p.Penetration = item.Evaluate(data.Penetration);
|
||||
p.Spread = item.Evaluate(data.DamageSpread);
|
||||
p.DamageType = data.DamageType;
|
||||
_lasers.Add(item, p);
|
||||
}
|
||||
|
||||
public override void StopFiring(EquippedItem item)
|
||||
{
|
||||
_lasers[item].Stop();
|
||||
_lasers.Remove(item);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue