public void Initialize(AudioSource sfxSource) { if (Initialized) { return; } UnityUpdateController.UpdateAgent.OnFixedUpdate += Update; _sfxSource = sfxSource; _correctAnswerClips = Resources.LoadAll <AudioClip>(CorrectAnswerClipsLocation).ToList(); _incorrectAnswerClips = Resources.LoadAll <AudioClip>(IncorrectAnswerClipsLocation).ToList(); CorrectAnswerSignal.AddListener(() => PlayRandomClipFromList(_correctAnswerClips)); IncorrectAnswerSignal.AddListener(() => PlayRandomClipFromList(_incorrectAnswerClips)); _initialized = true; }
private void Construct() { CorrectAnswerSignal.AddListener(OnCorrectAnswer); IncorrectAnswerSignal.AddListener(OnIncorrectAnswer); }
private void Initialize() { CorrectAnswerSignal.AddListener(() => gameObject.SetActive(false)); _rectTransform = GetComponent <RectTransform>(); }