dronkowitz

TeamDialog.cs

Jun 25th, 2021 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5.  
  6. public class TeamDialog : MonoBehaviour
  7. {
  8.     public int teamIndex = 0;
  9.     public AudioClip dialog1;
  10.     public AudioClip dialog2;
  11.     public AudioClip dialog3;
  12.     public AudioClip omochaodialog;
  13.     // Start is called before the first frame update
  14.     void Start()
  15.     {
  16.        
  17.     }
  18.  
  19.     // Update is called once per frame
  20.     void Update()
  21.     {
  22.        
  23.     }
  24.  
  25.     public void TeamSelected()
  26.     {
  27.         StartCoroutine(TeamSelectedCoroutine());
  28.     }
  29.     public IEnumerator TeamSelectedCoroutine()
  30.     {
  31.        
  32.         AudioSource asource = GetComponent<AudioSource>();
  33.         asource.clip = dialog1;
  34.         asource.Play();
  35.         while (asource.isPlaying)
  36.         {
  37.             yield return new WaitForSeconds(Time.deltaTime);
  38.         }
  39.         asource.clip = dialog2;
  40.         asource.Play();
  41.         while (asource.isPlaying)
  42.         {
  43.             yield return new WaitForSeconds(Time.deltaTime);
  44.         }
  45.         asource.clip = dialog3;
  46.         asource.Play();
  47.         while (asource.isPlaying)
  48.         {
  49.             yield return new WaitForSeconds(Time.deltaTime);
  50.         }
  51.     }
  52. }
  53.  
  54.     //0 = Team Sonic
  55.     //1 = Team Dark
  56.     //2 = Team Rose
  57.     //3 = Team Chaotix
  58.  
Add Comment
Please, Sign In to add comment