Aetheria/Assets/Scripts/Gameplay/Weapons/LaserManager.cs

25 lines
1.1 KiB
C#
Raw Normal View History

2021-01-05 02:56:17 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LaserManager : InstantWeaponEffectManager
2021-01-05 02:56:17 +00:00
{
public Prototype ProjectilePrototype;
public override void Fire(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target)
2021-01-05 02:56:17 +00:00
{
var p = ProjectilePrototype.Instantiate<Laser>();
2021-01-05 02:56:17 +00:00
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.EquippableItem, source.Entity);
var t = p.transform;
t.SetParent(barrel);
t.forward = barrel.forward;
t.position = barrel.position;
2021-01-05 02:56:17 +00:00
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity);
2021-01-08 12:44:10 +00:00
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item.EquippableItem, source.Entity);
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item.EquippableItem, source.Entity);
2021-01-05 02:56:17 +00:00
p.DamageType = data.DamageType;
}
}