private void OnEnable() { _particleSystem = target as ParticleSystem; //载入程序集 _assembly = Assembly.GetAssembly(typeof(Editor)); //获取ParticleSystemInspector类 _particleSystemInspector = _assembly.GetTypes().Where(t => t.Name == "ParticleSystemInspector").FirstOrDefault(); //获取OnInspectorGUI方法 _onInspectorGUI = _particleSystemInspector.GetMethod("OnInspectorGUI", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); //创建ParticleSystemInspector的实例 _particleSystemEditor = CreateEditor(target, _particleSystemInspector); _particlePath = _particleSystem.gameObject.GetComponent <ParticlePath>(); _currentCheckedPoint = -1; if (!_particlePath) { _particlePath = _particleSystem.gameObject.AddComponent <ParticlePath>(); _particlePath.IsApprove = true; _particlePath.hideFlags = HideFlags.HideInInspector; _particlePath.Waypoints = new List <Vector3>(); _particlePath.IsHideInInspector = false; _particlePath.PS = _particleSystem; } if (!_particlePath.IsApprove) { DestroyImmediate(_particlePath); _particlePath = _particleSystem.gameObject.AddComponent <ParticlePath>(); _particlePath.IsApprove = true; _particlePath.hideFlags = HideFlags.HideInInspector; _particlePath.Waypoints = new List <Vector3>(); _particlePath.IsHideInInspector = false; _particlePath.PS = _particleSystem; } }
public ParticlePath CreateSeekParticle(Vector2 position, Vector2 target, float time) { GameObject seekGO = Instantiate(_seekPrefab, _particleContainer); ParticlePath seek = seekGO.GetComponent <ParticlePath>(); seek.transform.position = position; seek.SetPath(target, time); return(seek); }
public void Deconstruct(out Type type, out ParticlePath path) { type = Type; path = Path; }
public LookupItem(Type type, ParticlePath path) { Type = type; Path = path; }