public static void DestroyEffect(TextureEffect effect) { if (!effect) { return; } //Debug.LogError("destory effect:" + effect.Deploy.id); if (effect.InCache) { Debug.LogError("invalidate to destroy effect in cache, " + effect.Deploy.id); } else { Holder holder; if (!CachePool.TryGetValue(effect.Deploy.id, out holder) || holder.Queue.Count >= OneCacheMax) { EntityBase.DestroyEntity(effect); } else { effect.OnRecycle(); effect.SetInCache(true); effect.transform.SetParent(CacheRoot, false); holder.Queue.Enqueue(effect); holder.BackToPoolTime = Time.realtimeSinceStartup; } } }
public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> debugInfos, IList <IComponentContainer> containers, IconLibrary library) : base(debugInfos, containers) { this.Device = device; this.Effect = effectFactory.Construct <TextureEffect>(); this.Library = library; this.Quad = new UnitQuad(device); }
public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> components, IComponentContainer <Pose> poses, IconLibrary library) { this.Device = device; this.Components = components; this.Poses = poses; this.Effect = effectFactory.Construct <TextureEffect>(); this.Library = library; this.Quad = new UnitQuad(device); }
public override void Init(BulletDeploy deploy, Transform master, MeshRenderer model) { _material = model.material; base.Init(deploy, master, model); //初始化被击特效 TextureEffectFactroy.CreateEffect(HitEffectId, SortingOrder.Effect, e => { _hitEffect = e; _hitEffect.SetActiveSafe(false); }); }
/// <summary> /// 显示UI特效 /// </summary> /// <param name="effect"></param> /// <param name="layerName"></param> public static void ShowEffect(TextureEffect effect, UiLayer layerName = UiLayer.Tips) { string layer = Enum.GetName(typeof(UiLayer), layerName); Transform parent = _uiBind.CanvasParentList[layerName]; if (parent == null) { Debug.LogError("ShowUIView 层级错误,使用了存在不存在的层:" + layer); return; } effect.transform.SetLayer(Layers.Ui); effect.gameObject.transform.SetParent(parent, false); }
public void Destroy() { if (_currBullet != null) { BulletFactory.DestroyBullet(_currBullet); _currBullet = null; } if (_slowEffect != null) { TextureEffectFactroy.DestroyEffect(_slowEffect); _slowEffect = null; } if (_fastEffect != null) { TextureEffectFactroy.DestroyEffect(_fastEffect); _fastEffect = null; } Destroy(gameObject); }
public void Init(PlayerSupportDeploy deploy, GameObject renderObj) { Deploy = deploy; if (deploy.slowShootEffectId > 0) { TextureEffectFactroy.CreateEffect(deploy.slowShootEffectId, SortingOrder.Effect, obj => { _slowEffect = obj; _slowEffect.transform.Bind(renderObj.transform); _slowEffect.SetActiveSafe(false); }); } if (deploy.fastShootEffectId > 0) { TextureEffectFactroy.CreateEffect(deploy.fastShootEffectId, SortingOrder.Effect, obj => { _fastEffect = obj; _fastEffect.transform.Bind(renderObj.transform); _fastEffect.SetActiveSafe(false); }); } }