2021-02-06 15:29:04 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
|
|
|
|
|
|
public class MineManager : InstantWeaponEffectManager
|
|
|
|
|
|
{
|
|
|
|
|
|
public Prototype ProjectilePrototype;
|
|
|
|
|
|
|
|
|
|
|
|
public override void Fire(InstantWeapon weapon, EquippedItem item, EntityInstance source, EntityInstance target)
|
|
|
|
|
|
{
|
|
|
|
|
|
var p = ProjectilePrototype.Instantiate<Mine>();
|
|
|
|
|
|
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
|
|
|
|
|
var barrel = source.GetBarrel(hp);
|
|
|
|
|
|
var angle = weapon.Spread / 2;
|
|
|
|
|
|
p.Source = source;
|
|
|
|
|
|
p.transform.position = barrel.position;
|
2021-04-15 04:25:22 +01:00
|
|
|
|
p.GridObject.Velocity = Quaternion.Euler(
|
|
|
|
|
|
Random.Range(-angle, angle),
|
|
|
|
|
|
Random.Range(-angle, angle),
|
2026-06-21 09:37:54 +01:00
|
|
|
|
Random.Range(-angle, angle)) *
|
2021-04-15 04:25:22 +01:00
|
|
|
|
barrel.forward *
|
|
|
|
|
|
weapon.Velocity;
|
2021-02-06 15:29:04 +00:00
|
|
|
|
p.Range = weapon.Range;
|
2026-07-05 19:36:19 +01:00
|
|
|
|
p.ImpactIntensity = 1;
|
2021-02-06 15:29:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|