54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
|
|
public class StartOutro : MonoBehaviour
|
|
{
|
|
public Transform resultView;
|
|
public GameObject audioObject;
|
|
public GameObject backgroundAudioSource; // Reference to the AudioSource component
|
|
private AudioSource audioSource; // Reference to the AudioSource component
|
|
public AudioClip clipOne;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
public void PlayFirstAudio()
|
|
{
|
|
Debug.Log("PlayFirstAudio");
|
|
if (clipOne != null)
|
|
{
|
|
|
|
audioSource.clip = clipOne;
|
|
}
|
|
if (audioSource != null && audioSource.clip != null)
|
|
{
|
|
audioSource.Play();
|
|
|
|
}
|
|
}
|
|
|
|
public void outroEnter(int Results)
|
|
{
|
|
|
|
audioObject.SetActive(true);
|
|
backgroundAudioSource.SetActive(true);
|
|
audioSource = audioObject.GetComponent<AudioSource>();
|
|
resultView = transform.Find("outrotext");
|
|
string resultString = $"Score: {Results}";
|
|
resultView.GetComponent<TextMeshProUGUI>().text = resultString;
|
|
PlayFirstAudio();
|
|
|
|
}
|
|
|
|
}
|