68 lines
1.6 KiB
C#
68 lines
1.6 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ȼ<EFBFBD><C8BB><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class Ambulance : SkillCar
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Transform leftPoliceWhistle;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ҿ<EFBFBD><D2BE><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Transform rightPoliceWhistle;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
|
|||
|
|
/// </summary>
|
|||
|
|
private Coroutine policeWhistleCoroutine;
|
|||
|
|
|
|||
|
|
private void OnDisable()
|
|||
|
|
{
|
|||
|
|
StopPoliceWhistle();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void PoliceWhistle()
|
|||
|
|
{
|
|||
|
|
policeWhistleCoroutine= StartCoroutine(IE_PoliceWhistle());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
|
|||
|
|
/// </summary>
|
|||
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ͣ
|
|||
|
|
/// </summary>
|
|||
|
|
public void StopPoliceWhistle()
|
|||
|
|
{
|
|||
|
|
if(policeWhistleCoroutine!=null)
|
|||
|
|
{
|
|||
|
|
leftPoliceWhistle.gameObject.SetActive(false);
|
|||
|
|
rightPoliceWhistle.gameObject.SetActive(false);
|
|||
|
|
StopCoroutine(policeWhistleCoroutine);
|
|||
|
|
policeWhistleCoroutine = null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|