using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// ¾È»¤³µ
///
public class Ambulance : SkillCar
{
///
/// ×󾯵Ñ
///
public Transform leftPoliceWhistle;
///
/// ÓÒ¾¯µÑ
///
public Transform rightPoliceWhistle;
///
/// ¾¯µÑгÌ
///
private Coroutine policeWhistleCoroutine;
private void OnDisable()
{
StopPoliceWhistle();
}
///
/// ¾¯µÑ
///
public void PoliceWhistle()
{
policeWhistleCoroutine= StartCoroutine(IE_PoliceWhistle());
}
///
/// ¾¯µÑгÌ
///
private IEnumerator IE_PoliceWhistle()
{
while (true)
{
leftPoliceWhistle.gameObject.SetActive(true);
rightPoliceWhistle.gameObject.SetActive(false);
yield return new WaitForSeconds(0.1f);
rightPoliceWhistle.gameObject.SetActive(true);
leftPoliceWhistle.gameObject.SetActive(false);
yield return new WaitForSeconds(0.1f);
}
}
///
/// ÔÝÍ£
///
public void StopPoliceWhistle()
{
if(policeWhistleCoroutine!=null)
{
leftPoliceWhistle.gameObject.SetActive(false);
rightPoliceWhistle.gameObject.SetActive(false);
StopCoroutine(policeWhistleCoroutine);
policeWhistleCoroutine = null;
}
}
}