RelicGrandfatherClock is a relic that increases a run timer stat when it levels up and plays a clock sound. On each LevelUp it calls the base Relic.LevelUp, adds 10 seconds to Manager's TimerTotalTime stat, resets TimeSinceTimerChanged and plays the grandfather_clock SFX at a slightly random pitch.
using Sandbox;
using System.Reflection.PortableExecutable;
using System.Runtime.Versioning;
using System.Threading.Tasks;
public class RelicGrandfatherClock : Relic
{
public override void LevelUp()
{
base.LevelUp();
Manager.Instance.Stats[StatType.TimerTotalTime] += 10f;
Manager.Instance.TimeSinceTimerChanged = 0f;
Manager.Instance.PlaySfxCenter( "grandfather_clock", volume: 1f, pitch: Game.Random.Float( 0.95f, 1f ) );
}
}