internal void HandleStop(EffectEntity effectEntity, bool isDestroyed) { if (isDestroyed) { if (effectEntity.State.IsPlaying()) { activeEffects.Remove(effectEntity); } else if (effectEntity.State.IsIdle()) { idleEffects.Remove(effectEntity); } effectEntity.Deinitialize(); GameObjectPool.Return(effectEntity, true); } else { Assert.IsTrue(effectEntity.State.IsPlaying(), $"Stopped effect with invalid state: {effectEntity.State} at: {effectEntity.GetPath()}!"); if (effectEntity.State.IsPlaying()) { activeEffects.Remove(effectEntity); idleEffects.Add(effectEntity); } effectEntity.gameObject.SetActive(false); effectEntity.transform.parent = reference.containerTransform; } }
private void AddEffect() { EffectEntity newEffect = GameObjectPool.Take(effectSettings.Prototype, Vector3.zero, Quaternion.identity, reference.containerTransform); newEffect.Initialize(effectSettings); idleEffects.Add(newEffect); newEffect.gameObject.SetActive(false); }
public IEffectEntity PlayEffect(Vector3 position, Quaternion rotation, out long playId, Transform parent = null) { Assert.IsNotNull(EffectContainer, $"Effect {name} is not initialized and won't play!"); if (EffectContainer != null) { EffectEntity newEffect = EffectContainer.Play(position, rotation, parent); playId = newEffect?.PlayId ?? -1; return(newEffect); } playId = -1; return(null); }
public void Replay() { EffectEntity.Replay(PlayId); }
public void Stop() { EffectEntity.Stop(PlayId); }
public void Fade() { EffectEntity.Fade(PlayId); }
internal void HandleFade(EffectEntity effectEntity) { effectEntity.transform.parent = reference.containerTransform; }
internal void HandleFade(EffectEntity effectEntity) { EffectContainer.HandleFade(effectEntity); }
internal void HandleStop(EffectEntity effectEntity, bool isDestroyed) { EffectContainer.HandleStop(effectEntity, isDestroyed); }