public static IEnumerator DoSteamEffect(IPortraitable portrait, Color color) { ExplosionView ev = ObjectPoolManager.Instance.Get(EffectsManager.Instance.SteamBurst); ev.Play(); portrait.ParentToEffects(ev.gameObject); yield return(new WaitUntil(() => ev.IsDone)); ObjectPoolManager.Instance.Return(ev); }
public static IEnumerator DoSteamEffect(IPortraitable portrait, Color color) { ExplosionView ev = ObjectPoolManager.Instance.Get(EffectsManager.Instance.SteamBurst); ev.Play(); ev.Color = color; portrait.ParentToEffects(ev.gameObject); yield return(new WaitUntil(() => portrait.RectTransform != null)); Main.Instance.StartCoroutine(Shake(portrait.RectTransform, 100, 0.5f)); yield return(new WaitUntil(() => ev.IsDone)); ObjectPoolManager.Instance.Return(ev); }
/// <summary> /// Death effect for a portrait. /// </summary> /// <param name="portrait">The portrait.</param> /// <param name="effectHolder">The effect holder.</param> /// <param name="fadeDuration">Duration of the fade.</param> /// <returns></returns> public static IEnumerator DoDeathEffect(IPortraitable portrait, float fadeDuration) { Rect rect = portrait.RectTransform.rect; Vector2 dimensions = new Vector2(rect.width, rect.height); ExplosionView ev = ObjectPoolManager.Instance.Get(EffectsManager.Instance.Explosion); ev.Dimensions = dimensions; portrait.ParentToEffects(ev.gameObject); ev.Play(); yield return(DoHitSplat(portrait, "DEFEAT", Color.red, Util.GetSprite("skull-crossed-bones"))); yield return(new WaitUntil(() => ev)); ObjectPoolManager.Instance.Return(ev); }
/// <summary> /// Effect where portrait runs up to another portrait, hits it, and retreats /// </summary> /// <param name="mover">The moving portrait.</param> /// <param name="destination">The destination.</param> /// <param name="duration">The duration.</param> /// <param name="soundLoc">The sound loc.</param> /// <returns></returns> public static IEnumerator DoMeleeEffect(IPortraitable mover, IPortraitable destination, float duration, string soundLoc) { // Move mover to upper layer so it is on top of all elements int index = mover.RectTransform.GetSiblingIndex(); GameObject parent = mover.RectTransform.parent.gameObject; Util.Parent(mover.RectTransform.gameObject, EffectsManager.Instance.Foreground); Vector2 moverOriginalPos = mover.RectTransform.position; yield return(MoveTowards(mover.RectTransform, destination.RectTransform, duration / 3)); Presenter.Main.Instance.Sound.PlaySound(soundLoc); yield return(Shake(destination.RectTransform, 100, duration / 3)); yield return(MoveBack(mover.RectTransform, moverOriginalPos, duration / 3)); Util.Parent(mover.RectTransform.gameObject, parent); mover.RectTransform.SetSiblingIndex(index); }
/// <summary> /// Creates a hitsplat. /// </summary> /// <param name="parent">The parent.</param> /// <param name="splat">The splat.</param> /// <returns></returns> public static IEnumerator DoHitSplat(IPortraitable parent, SplatDetails splat) { return(DoHitSplat(parent, splat.Text, splat.Color, splat.Sprite)); }
/// <summary> /// Creates a hitsplat. /// </summary> /// <param name="parent">The parent.</param> /// <param name="splatText">The splat text.</param> /// <param name="splatColor">The splat color.</param> /// <param name="sprite">The sprite.</param> /// <returns></returns> public static IEnumerator DoHitSplat(IPortraitable parent, string splatText, Color splatColor, Sprite sprite = null) { HitsplatView hp = ObjectPoolManager.Instance.Get(EffectsManager.Instance.Hitsplat); return(hp.Animation(go => parent.ParentToEffects(go), splatText, splatColor, sprite)); }
public static IEnumerator DoSteamEffect(IPortraitable portrait) { yield return(DoSteamEffect(portrait, Color.white)); }