public bool isAlarmOn = false;
private GameObject[] alarmsSound;
private AlarmLight alarmlight;
private void Awake()
{
isAlarmOn = false; alarmsSound = GameObject.FindGameObjectsWithTag("alarm");
alarmlight = GameObject.Find("AlarmLight").GetComponent<AlarmLight>();
}
void Update ()
{ alarmlight.isAlarmOn = this.isAlarmOn;
}
private void PlayAlarm()
{
foreach (GameObject go in alarmsSound)
{
if (!go.audio.isplaying) //出问题的代码
{
}
}
}
}