Every Unity.Mathematics using, alias and qualified name under Assets\Scripts and tools now names CultMath. The nine `using static ...noise;` lines are gone: snoise lives on CultMath's math. UnityExtensions loses float4.ToColor and Color.ToFloat4, which duplicate the bridge's ToColor and ToCultMath; the float3 colour pair stays because the bridge has none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using CultMath;
|
|
using static CultMath.math;
|
|
using Random = UnityEngine.Random;
|
|
|
|
public class MineManager : InstantWeaponEffectManager
|
|
{
|
|
public Prototype ProjectilePrototype;
|
|
public bool InheritVelocity;
|
|
|
|
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;
|
|
p.GridObject.Velocity = Quaternion.Euler(
|
|
Random.Range(-angle, angle),
|
|
Random.Range(-angle, angle),
|
|
Random.Range(-angle, angle)) *
|
|
barrel.forward *
|
|
weapon.Velocity;
|
|
if(InheritVelocity)
|
|
p.GridObject.Velocity += new Vector3(source.Entity.Velocity.x, 0, source.Entity.Velocity.y);
|
|
p.Damage = weapon.Damage;
|
|
p.Range = weapon.Range;
|
|
p.DamageType = weapon.WeaponData.DamageType;
|
|
p.GridObject.Zone = source.Entity.Zone;
|
|
}
|
|
}
|