83 lines
1.9 KiB
C#
83 lines
1.9 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.Events;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ܳ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class SkillCar : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// ԭ<><D4AD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Material thisMaterial;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>˸<EFBFBD><CBB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Material flashingMaterial;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ
|
|||
|
|
/// </summary>
|
|||
|
|
public MeshRenderer[] meshRenderers;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>˸<EFBFBD><CBB8>Ч
|
|||
|
|
/// </summary>
|
|||
|
|
private Coroutine flashingCoroutine;
|
|||
|
|
|
|||
|
|
private void OnDisable()
|
|||
|
|
{
|
|||
|
|
if(flashingCoroutine!=null)
|
|||
|
|
{
|
|||
|
|
StopCoroutine(flashingCoroutine);
|
|||
|
|
flashingCoroutine = null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>˸
|
|||
|
|
/// </summary>
|
|||
|
|
public void Flashing(UnityAction callBack)
|
|||
|
|
{
|
|||
|
|
flashingCoroutine= StartCoroutine(IE_Flashing(callBack));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ֹͣ<CDA3><D6B9>˸
|
|||
|
|
/// </summary>
|
|||
|
|
public void StopFlashing()
|
|||
|
|
{
|
|||
|
|
if (flashingCoroutine != null)
|
|||
|
|
{
|
|||
|
|
StopCoroutine(flashingCoroutine);
|
|||
|
|
flashingCoroutine = null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>˸Э<CBB8><D0AD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private IEnumerator IE_Flashing(UnityAction callBack)
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetShimmerCountDownSetActive(true);
|
|||
|
|
for (int i = 0; i < 10; i++)
|
|||
|
|
{
|
|||
|
|
for (int j = 0; j < meshRenderers.Length; j++)
|
|||
|
|
{
|
|||
|
|
meshRenderers[j].material = flashingMaterial;
|
|||
|
|
}
|
|||
|
|
yield return new WaitForSeconds(0.2f);
|
|||
|
|
for (int j = 0; j < meshRenderers.Length; j++)
|
|||
|
|
{
|
|||
|
|
meshRenderers[j].material = thisMaterial;
|
|||
|
|
}
|
|||
|
|
yield return new WaitForSeconds(0.2f);
|
|||
|
|
}
|
|||
|
|
callBack?.Invoke();
|
|||
|
|
}
|
|||
|
|
}
|