A subclass of SpikerHead that configures a miniboss variant. It sets spawn scale, lifetime, hit force and damage based on difficulty, and after half its lifetime spawns a lava puddle via Manager.Instance.SpawnLavaPuddleRpc once.
using System;
using Sandbox;
public class SpikerHeadMiniboss2 : SpikerHead
{
public override Vector3 SpawnScale => new Vector3( 1.8f );
private bool _hasCreatedPuddle;
protected override void OnStart()
{
base.OnStart();
Lifetime = 1.7f;
if ( IsProxy )
return;
_hitForce = 380f;
//_depthBottom = -250f;
//_depthTop = -195f;
Damage = Utils.Select( Manager.Instance.Difficulty, 9f, 11f, 12f );
}
protected override void OnUpdate()
{
base.OnUpdate();
if ( IsProxy )
return;
if( !_hasCreatedPuddle && TimeSinceSpawn > Lifetime * 0.5f )
{
var lifetime = Utils.Select( Manager.Instance.Difficulty, 7f, 10f, 14f );
Manager.Instance.SpawnLavaPuddleRpc(
pos: Position2D,
damage: 2f,
radius: Game.Random.Float( 150f, 170f ),
lifetime: lifetime * Game.Random.Float( 0.95f, 1.05f ),
colorA: new Color( 0.5f, 0.3f, 1f ),
colorB: new Color( 0.6f, 0.6f, 1f ),
alphaMax: 0.4f,
enemySource: null,
enemyType: EnemyType.MinibossSpiker2
);
_hasCreatedPuddle = true;
}
}
}