示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
 /// <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));
 }
示例#6
0
        /// <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));
        }
示例#7
0
 public static IEnumerator DoSteamEffect(IPortraitable portrait)
 {
     yield return(DoSteamEffect(portrait, Color.white));
 }