using System.IO;
using System.Text.RegularExpressions;
using UnityEngine;
using System.Linq;
using System;
using UniRx;
using System.Text;
using Debug = UnityEngine.Debug;
namespace MiliP
{
// *** :存放公用方法的类
public static class MiLiPExtensions
{
/// <summary>
/// // *** 高亮
/// </summary>
public static void HighLight(this Transform _target, bool _bLight)
{
shaderGlow sg = _target.GetComponent<shaderGlow>();
if (_bLight)
{
if (sg == null)
{
sg = _target.gameObject.AddComponent<shaderGlow>();
}
sg.glowMode = shaderGlow.allowedModes.userCallFunctions;
sg.flashing = true;
sg.lightOn();
}
else
{
if (sg != null)
{
if (sg.glowMode != shaderGlow.allowedModes.userCallFunctions)
{
sg.glowMode = shaderGlow.allowedModes.userCallFunctions;
}
sg.lightOff();
//Object.Destroy(_target.GetComponent<shaderGlow>());
}
}
}
public static void SetAllChildrenLayer(this Transform _target, string _layerName)
{
Renderer[] rens = _target.GetComponentsInChildren<Renderer>();
foreach (var item in rens)
{
item.gameObject.layer = LayerMask.NameToLayer(_layerName);
}
}
public static void SetAllChildrenLayer(this Transform _target, int _layer)
{
Renderer[] rens = _target.GetComponentsInChildren<Renderer>();
foreach (var item in rens)
{
item.gameObject.layer = _layer;
}
}
}
}
公用方法类
最新推荐文章于 2022-03-01 17:45:39 发布