Player/Tools/HeliTool.cs
namespace PlanetMeat;
[Title( "Heli" ), Icon( "flight_land" )]
public sealed class HeliTool : PlayerTool, IUpgradeableAttack, IUpgradeableStrike, IUpgradeableDuration
{
private static GameObject ZonePrefab => GameObject.GetPrefab( "tools/heli/heli_zone.prefab" );
public const float HELI_TOOL_COOLDOWN = 15.0f;
public override float BaseCooldown => HELI_TOOL_COOLDOWN;
public ValueAggregator<int> AggregateDamage => field ??= ValueAggregator<int>.FromImprovement( "heli_dmg", 10 );
public ValueAggregator<int> AggregateSize => field ??= new( 200 );
public ValueAggregator<float> AggregateSpeed => field ??= ValueAggregator<float>.FromImprovement( "heli_speed", 0.2f );
public ValueAggregator<float> AggregateAccuracy => field ??= ValueAggregator<float>.FromImprovement( "heli_acc", 0.2f );
public ValueAggregator<float> AggregateDurationMult => field ??= ValueAggregator<float>.FromImprovement( "heli_duration", 0.5f );
protected override IWorldRing NextWorldRing => TimedRing.Create( WorldPosition, this.GetStrikeSize() );
public override void OnPlaceEnded( Vector3 position )
{
base.OnPlaceEnded( position );
if ( IsUsable )
{
StartCooldown();
if ( ZonePrefab.Clone( position ).Components.Get<SnipeZone>() is SnipeZone snipe )
{
snipe.ApplyConfig(
1.0f / this.GetStrikeSpeed(),
this.GetDurationMult(),
this.GetAttackDamage(),
this.GetStrikeAccuracy(),
this.GetStrikeSize()
);
}
}
}
}