Пример #1
0
        public IEnumerable <IRenderable> Render(WPos pos, WVec offset, int zOffset, PaletteReference palette, float scale)
        {
            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                yield return(new SpriteRenderable(shadow, pos, offset, CurrentSequence.ShadowZOffset + zOffset, palette, scale, true));
            }

            yield return(new SpriteRenderable(Image, pos, offset, CurrentSequence.ZOffset + zOffset, palette, scale, IsDecoration));
        }
Пример #2
0
        public IRenderable[] Render(WPos pos, WVec offset, int zOffset, PaletteReference palette, float scale)
        {
            var imageRenderable = new SpriteRenderable(Image, pos, offset, CurrentSequence.ZOffset + zOffset, palette, scale, IsDecoration);

            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow           = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                var shadowRenderable = new SpriteRenderable(shadow, pos, offset, CurrentSequence.ShadowZOffset + zOffset, palette, scale, true);
                return(new IRenderable[] { shadowRenderable, imageRenderable });
            }

            return(new IRenderable[] { imageRenderable });
        }
Пример #3
0
        public IRenderable[] Render(WPos pos, WVec offset, int zOffset, PaletteReference palette)
        {
            var tintModifiers   = CurrentSequence.IgnoreWorldTint ? TintModifiers.IgnoreWorldTint : TintModifiers.None;
            var imageRenderable = new SpriteRenderable(Image, pos, offset, CurrentSequence.ZOffset + zOffset, palette, CurrentSequence.Scale, IsDecoration, tintModifiers);

            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow           = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                var shadowRenderable = new SpriteRenderable(shadow, pos, offset, CurrentSequence.ShadowZOffset + zOffset, palette, CurrentSequence.Scale, true, tintModifiers);
                return(new IRenderable[] { shadowRenderable, imageRenderable });
            }

            return(new IRenderable[] { imageRenderable });
        }
Пример #4
0
        public IRenderable[] RenderUI(int2 pos, WVec offset, int zOffset, PaletteReference palette, float scale)
        {
            var imagePos        = pos - new int2((int)(scale * Image.Size.X / 2), (int)(scale * Image.Size.Y / 2));
            var imageRenderable = new UISpriteRenderable(Image, WPos.Zero + offset, imagePos, CurrentSequence.ZOffset + zOffset, palette, scale);

            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow           = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                var shadowPos        = pos - new int2((int)(scale * shadow.Size.X / 2), (int)(scale * shadow.Size.Y / 2));
                var shadowRenderable = new UISpriteRenderable(shadow, WPos.Zero + offset, shadowPos, CurrentSequence.ShadowZOffset + zOffset, palette, scale);
                return(new IRenderable[] { shadowRenderable, imageRenderable });
            }

            return(new IRenderable[] { imageRenderable });
        }
Пример #5
0
        public IRenderable[] RenderUI(WorldRenderer wr, int2 pos, WVec offset, int zOffset, PaletteReference palette, float scale = 1f)
        {
            scale *= CurrentSequence.Scale;
            var screenOffset    = (scale * wr.ScreenVectorComponents(offset)).XY.ToInt2();
            var imagePos        = pos + screenOffset - new int2((int)(scale * Image.Size.X / 2), (int)(scale * Image.Size.Y / 2));
            var imageRenderable = new UISpriteRenderable(Image, WPos.Zero + offset, imagePos, CurrentSequence.ZOffset + zOffset, palette, scale);

            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow           = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                var shadowPos        = pos - new int2((int)(scale * shadow.Size.X / 2), (int)(scale * shadow.Size.Y / 2));
                var shadowRenderable = new UISpriteRenderable(shadow, WPos.Zero + offset, shadowPos, CurrentSequence.ShadowZOffset + zOffset, palette, scale);
                return(new IRenderable[] { shadowRenderable, imageRenderable });
            }

            return(new IRenderable[] { imageRenderable });
        }