Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using AC;
- public class VoiceSound1 : MonoBehaviour {
- public AudioClip myAudioClip;
- public AudioClip myAudioClip2;
- // Use this for initialization
- void GetSpeech (AC.Char speakingCharacter, string speechText, int lineID)
- {
- if (speakingCharacter != null && speakingCharacter.gameObject.name == "Test 1" || speakingCharacter.gameObject.name == "Test 2")
- {
- float randValue = Random.value;
- if (randValue < .30f)
- {
- AudioSource.PlayClipAtPoint (myAudioClip, AC.KickStarter.mainCamera.transform.position);
- }
- else if (randValue < .70f)
- {
- AudioSource.PlayClipAtPoint (myAudioClip2, AC.KickStarter.mainCamera.transform.position);
- }
- }
- }
- private void OnEnable()
- {
- EventManager.OnStartSpeech +=GetSpeech;
- }
- private void OnDisable()
- {
- EventManager.OnStartSpeech -=GetSpeech;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement