using System.Collections; using System.Collections.Generic; using UnityEngine; //using System; using UnityEngine.Audio; public class SaySomething : MonoBehaviour { //[SerializeField] private List playerHealths; [SerializeField] private List prases; [SerializeField] private HealthController health; void Start() { health = FindObjectOfType(); foreach(Sounds p in prases) { p.source = gameObject.AddComponent(); p.source.clip = p.clip; p.source.volume = p.volume; p.source.pitch = p.pitch; } // playerHealths = new List( FindObjectsOfType()); // //playerHealths.AddRange( ); // foreach(HealthController hc in playerHealths) // { // if(hc.currentHealth <= 0) // { // //FindObjectOfType().PlayPhrase(Random.Range(0, 15)); // } // } } // Update is called once per frame private void Update() { if(health.currentHealth <= 0) { Say(); } } public void Say() { if() } }