relics/RelicSalad.cs

A Relic subclass, RelicSalad. On level up it raycasts from the camera through the mouse position, plays a "salad" sound, spawns a max HP floater at the hit point and adds 1 to the manager's max HP, resetting the HP change timer.

using Sandbox;
using System.Reflection.PortableExecutable;
using System.Runtime.Versioning;
using System.Threading.Tasks;

public class RelicSalad : Relic
{
	public override void LevelUp()
	{
		base.LevelUp();

		var mouse = Mouse.Position;
		var camera = Scene.Camera;
		var ray = camera.ScreenPixelToRay( mouse );

		var tr = Scene.Trace.Ray( ray, 10000f ).Run();

		Manager.Instance.PlaySfxCenter( "salad", volume: 0.85f, pitch: Game.Random.Float( 0.95f, 1.05f ) );

		int maxHP = 1;
		Manager.Instance.SpawnMaxHPFloater( maxHP, tr.EndPosition );
		Manager.Instance.MaxHP += maxHP;

		Manager.Instance.TimeSinceHPChanged = 0f;
	}
}