//*********************************************************** // Filename: AudioFeedback.cs // Author: Marco Fendrich, Moritz Kolvenbach // Last changes: Thursday, 9th of August 2018 // Content: Handles the audio feedback during the trials //*********************************************************** using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// A class managing the audio cues throughout the experiment /// public class AudioFeedback : MonoBehaviour { // the sound being played on targetConfirmation public AudioSource targetAudio; // the sound being played when all targets of the current condition have been completed public AudioSource gameEndAudio; /// /// Registers the listeners for each event that triggers an audio cue /// void Start () { TargetReachedEvent.RegisterListener(OnTargetConfirmation); ExperimentEndEvent.RegisterListener(OnExperimentEnd); } /// /// On target confirmation play sound /// /// An event being triggerd whenever the player confirms a target void OnTargetConfirmation(TargetReachedEvent trEv) { targetAudio.Play(0); } /// /// On experiment end play sound /// /// An event being triggerd when experiment is over void OnExperimentEnd(ExperimentEndEvent eeEv) { gameEndAudio.Play(0); } }