Player/PlayerPawn.Audio.cs

Partial PlayerPawn class file handling audio. It defines a MedicSound field and a SoundTick method that updates the audio component each tick and plays a medic voice sound when the player presses the Use input.

Native Interop
namespace KOTH;

public partial class PlayerPawn
{
	/// <summary>
	/// Represents the sound event associated with the "Medic" audio cue for the player character.
	/// </summary>
	public FSound MedicSound;

	/// <summary>
	/// Performs audio updates for the player pawn, handling sound-related behavior and interactions.
	/// </summary>
	/// <remarks>
	/// This method primarily updates the audio state by delegating to the SoundTick method of the
	/// audio component.
	/// </remarks>
	private void SoundTick()
	{
		AudioComponent.Instance.SoundTick();
		if (Input.Pressed("Use"))
		{
			MedicSound = new FSound(PlayerPawnDefinition.CharacterDefinition.MedicVoiceEvent, WorldPosition, this,
				true);
			AudioComponent.Instance.PlaySound(MedicSound);
		}
	}
}