コード例 #1
0
ファイル: Animation.cs プロジェクト: epicelite/OpenRA
        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
ファイル: Animation.cs プロジェクト: stonezhao28/OpenRA
        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
ファイル: Animation.cs プロジェクト: stonezhao28/OpenRA
        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 });
        }