Weapos Rejiggered
Modified weapon scripts to eliminate specialized projectile behavior - allows charged weapons to have projectiles and modify weapon stats when charged Added machine gun weapon & VFX Moved third party code to Plugins folder to improve compile times
This commit is contained in:
parent
2a0fe34611
commit
dbc522a224
2105 changed files with 7033 additions and 1141 deletions
|
|
@ -5,27 +5,28 @@ using UnityEngine;
|
|||
public class ProjectileManager : InstantWeaponEffectManager
|
||||
{
|
||||
public Prototype ProjectilePrototype;
|
||||
public bool InheritVelocity;
|
||||
|
||||
public override void Fire(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target)
|
||||
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target)
|
||||
{
|
||||
if(data is ProjectileWeaponData projectile)
|
||||
{
|
||||
var p = ProjectilePrototype.Instantiate<Projectile>();
|
||||
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);
|
||||
p.StartPosition = p.transform.position = barrel.position;
|
||||
var angle = source.Entity.ItemManager.Evaluate(projectile.Spread, item.EquippableItem, source.Entity) / 2;
|
||||
p.Velocity = (Quaternion.Euler(Random.Range(-angle, angle), Random.Range(-angle, angle), Random.Range(-angle, angle)) * barrel.forward) *
|
||||
source.Entity.ItemManager.Evaluate(projectile.Velocity, item.EquippableItem, source.Entity);
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item.EquippableItem, source.Entity);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item.EquippableItem, source.Entity);
|
||||
p.DamageType = data.DamageType;
|
||||
p.Zone = source.Entity.Zone;
|
||||
p.Trail.Clear();
|
||||
}
|
||||
else Debug.LogError($"Weapon {item.EquippableItem.Name} linked to {name} effect, but is not a Projectile Weapon!");
|
||||
var p = ProjectilePrototype.Instantiate<Projectile>();
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
var angle = weapon.Spread / 2;
|
||||
p.SourceEntity = source.Entity;
|
||||
p.StartPosition = p.transform.position = barrel.position;
|
||||
p.Velocity = Quaternion.Euler(
|
||||
Random.Range(-angle, angle),
|
||||
Random.Range(-angle, angle),
|
||||
Random.Range(-angle, angle)) *
|
||||
barrel.forward *
|
||||
weapon.Velocity;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.WeaponData.DamageType;
|
||||
p.Zone = source.Entity.Zone;
|
||||
p.Trail.Clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue