A relic pickup that runs on level up. It traces from the camera through the mouse cursor, plays the "mammoth_meat" sound, spawns a max HP floater at the hit position and adds 8 to the player's MaxHP, then resets the HP change timer.
using Sandbox;
using System.Reflection.PortableExecutable;
using System.Runtime.Versioning;
using System.Threading.Tasks;
public class RelicMammothMeat : 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( "mammoth_meat", volume: 0.75f, pitch: Game.Random.Float( 0.85f, 0.9f ) );
int maxHpAmount = 8;
Manager.Instance.SpawnMaxHPFloater( maxHpAmount, tr.EndPosition );// + new Vector3(0f, -30f, 0f) );
Manager.Instance.MaxHP += maxHpAmount;
//int hpAmount = 5;
//Manager.Instance.HP = Math.Min( Manager.Instance.HP + hpAmount, Manager.Instance.MaxHP );
Manager.Instance.TimeSinceHPChanged = 0f;
//Manager.Instance.SpawnHealHPFloater( hpAmount, tr.EndPosition );
}
}