예제 #1
0
 private void Speak(string[] options)
 {
     if (speech && options != null && options.Length > 0)
     {
         speech.Speak(options [Random.Range(0, options.Length)]);
     }
 }
예제 #2
0
        private void OnLightDecrease(LightDecreaseEvent e)
        {
            _audio.PlaySound(PickUpAudio, 0.5f, -1.1f);
            StartCoroutine(Hurt());

            if (speech && HasSpeechOptions(LightDecreaseSpeech))
            {
                speech.Speak(LightDecreaseSpeech [Random.Range(0, LightDecreaseSpeech.Length)]);
            }

            if (e.LightAmount.HasValue)
            {
                _light.intensity -= e.LightAmount.Value;
            }

            if (e.RadiusAmount.HasValue)
            {
                _light.range -= e.RadiusAmount.Value;
            }

            CheckLightEmpty();
        }
예제 #3
0
        private IEnumerator ShowText(string text, int i)
        {
            characterSpeech.Speak(Speech [i]);

            yield return(new WaitForSeconds(text.Length * 0.15f));

            if (i < Speech.Length - 1)
            {
                i++;
                StartCoroutine(ShowText(Speech [i], i));
            }
            else
            {
                FinishedSpeaking();
            }
        }
        void Update()
        {
            if (IntroductorySpeech.instance.InProgress)
            {
                return;
            }

            if (currentThrowable != null && !currentThrowable.activeSelf)
            {
                currentThrowable = null;
            }

            if (currentThrowable != null)
            {
                return;
            }

            if (Input.GetMouseButtonDown(0))
            {
                if (currentThrowableCount-- <= 0)
                {
                    if (speech && HasSpeechOptions())
                    {
                        speech.Speak(SpeechOnEmpty [Random.Range(0, SpeechOnEmpty.Length)]);
                    }
                    return;
                }

                var sp  = Camera.main.WorldToScreenPoint(transform.position);
                var dir = (Input.mousePosition - sp).normalized;

                currentThrowable = ObjectManager.instance.GetObject(Throwable.name, transform.position);

                currentThrowable.GetComponent <Rigidbody2D> ().AddForce(dir * Force);
            }
        }
		void OnEnemyKilled (EnemyKilled e)
		{
			characterSpeech.Speak (EnemyKilledSpeech [Random.Range (0, EnemyKilledSpeech.Length)]);
		}