/// <summary> /// 开启闪光,使用指定频率 /// </summary> /// <param name="target">目标物体</param> /// <param name="color1">颜色1</param> /// <param name="color2">颜色2</param> /// <param name="freq">频率</param> public static void OpenFlashHighLight(this GameObject target, Color color1, Color color2, float freq) { HighlightableObject ho = target.GetComponent <HighlightableObject>(); if (ho == null) { ho = target.AddComponent <HighlightableObject>(); } ho.FlashingOn(color1, color2, freq); }
/// <summary> /// 开启闪光,使用默认颜色和频率 /// </summary> /// <param name="target">目标物体</param> public static void OpenFlashHighLight(this GameObject target) { HighlightableObject ho = target.GetComponent <HighlightableObject>(); if (ho == null) { ho = target.AddComponent <HighlightableObject>(); } ho.FlashingOn(Color.red, Color.white, 2); }
/// <summary> /// 开启闪光,使用指定频率 /// </summary> /// <param name="target">目标物体</param> /// <param name="color1">颜色1</param> /// <param name="color2">颜色2</param> /// <param name="freq">频率</param> public static void OpenFlashHighLight(this GameObject target, Color color1, Color color2, float freq) { HOS.Clear(); target.transform.GetComponentsInChildren(true, HOS); for (int i = 0; i < HOS.Count; i++) { HOS[i].FlashingOff(); HOS[i].Die(); } HighlightableObject ho = target.GetComponent <HighlightableObject>(); if (ho == null) { ho = target.AddComponent <HighlightableObject>(); } ho.FlashingOn(color1, color2, freq); }