Esempio n. 1
0
        public override void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            if (Finished)
            {
                return;
            }

            DirSheet sheet = GraphicsManager.GetBackground(Anim.AnimIndex);

            int   frame = Time.ToFrames();
            Loc   diff  = Movement * frame / 60 - offset;
            float fade  = 1f;// (float)Math.Min(Math.Min(FadeTime, frame), (TotalTime > 0) ? Math.Min(FadeTime, TotalTime - frame) : FadeTime) / FadeTime;

            if (sheet.Width == 1 && sheet.Height == 1)
            {
                sheet.DrawTile(spriteBatch, new Rectangle(0, 0, GraphicsManager.ScreenWidth, GraphicsManager.ScreenHeight), 0, 0, Color * ((float)Anim.Alpha * fade / 255f));
            }
            else
            {
                for (int x = diff.X % sheet.TileWidth - sheet.TileWidth; x < GraphicsManager.ScreenWidth; x += sheet.TileWidth)
                {
                    for (int y = diff.Y % sheet.TileHeight - sheet.TileHeight; y < GraphicsManager.ScreenHeight; y += sheet.TileHeight)
                    {
                        sheet.DrawDir(spriteBatch, new Vector2(x, y), Anim.GetCurrentFrame(Time, sheet.TotalFrames), Anim.AnimDir, Color * ((float)Anim.Alpha * fade / 255f));
                    }
                }
            }
        }
Esempio n. 2
0
        public override void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            Loc drawLoc = GetDrawLoc(offset);

            DirSheet sheet = GraphicsManager.GetItem(Sprite);

            sheet.DrawDir(spriteBatch, drawLoc.ToVector2(), 0);
        }
Esempio n. 3
0
 public void Draw(SpriteBatch spriteBatch, Loc parentLoc, Dir8 dir, int locHeight, float sizeRatio)
 {
     foreach (MultiAnimSprite sprite in Sprites)
     {
         DirSheet sheet = GraphicsManager.GetAttackSheet(sprite.AnimIndex);
         sheet.DrawDir(spriteBatch, new Vector2(parentLoc.X, parentLoc.Y - locHeight) + sprite.Position.ToVector2() * sizeRatio, sprite.Frame, DirExt.AddAngles(dir, sprite.AnimDir), Color.White * ((float)sprite.Alpha / 255));
     }
 }
Esempio n. 4
0
        public override void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            if (Finished)
            {
                return;
            }

            Loc drawLoc = GetDrawLoc(offset);

            DirSheet sheet = GraphicsManager.GetAttackSheet(Anim.AnimIndex);

            sheet.DrawDir(spriteBatch, new Vector2(drawLoc.X, drawLoc.Y - LocHeight), Anim.GetCurrentFrame(ActionTime + FrameOffset, GraphicsManager.GetAttackSheet(Anim.AnimIndex).TotalFrames), Anim.GetDrawDir(Direction), Color.White * ((float)Anim.Alpha / 255));
        }
Esempio n. 5
0
        public override void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            if (Finished)
                return;

            Loc drawLoc = GetDrawLoc(offset);
            Loc modOffset = new Loc(GraphicsManager.ScreenWidth - offset.X % GraphicsManager.ScreenWidth, GraphicsManager.ScreenHeight - offset.Y % GraphicsManager.ScreenHeight);
            drawLoc = drawLoc + modOffset;
            Vector2 drawDest = new Vector2(drawLoc.X % GraphicsManager.ScreenWidth, (drawLoc.Y - LocHeight) % GraphicsManager.ScreenHeight);

            DirSheet sheet = GraphicsManager.GetAttackSheet(Anim.AnimIndex);
            sheet.DrawDir(spriteBatch, drawDest, Anim.GetCurrentFrame(ActionTime, GraphicsManager.GetAttackSheet(Anim.AnimIndex).TotalFrames), DirExt.AddAngles(Direction, Anim.AnimDir), Color.White * ((float)Anim.Alpha / 255));

        }
Esempio n. 6
0
        public override void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            if (Finished)
            {
                return;
            }

            DirSheet sheet = GraphicsManager.GetBackground(Anim.AnimIndex);

            int   frame = Time.ToFrames();
            Color color = StartColor;

            if (frame < FadeInTime)
            {
                color = interpolateColor(StartColor, EndColor, frame, FadeInTime);
            }
            else if (frame < FadeInTime + HoldTime)
            {
                color = EndColor;
            }
            else if (frame < FadeInTime + HoldTime + FadeOutTime)
            {
                int endTime = FadeInTime + HoldTime + FadeOutTime;
                color = interpolateColor(StartColor, EndColor, endTime - frame, FadeOutTime);
            }

            Loc diff = -offset;

            if (sheet.Width == 1 && sheet.Height == 1)
            {
                sheet.DrawTile(spriteBatch, new Rectangle(0, 0, GraphicsManager.ScreenWidth, GraphicsManager.ScreenHeight), 0, 0, color);
            }
            else
            {
                for (int x = diff.X % sheet.TileWidth - sheet.TileWidth; x < GraphicsManager.ScreenWidth; x += sheet.TileWidth)
                {
                    for (int y = diff.Y % sheet.TileHeight - sheet.TileHeight; y < GraphicsManager.ScreenHeight; y += sheet.TileHeight)
                    {
                        sheet.DrawDir(spriteBatch, new Vector2(x, y), Anim.GetCurrentFrame(Time, sheet.TotalFrames), Anim.GetDrawDir(Dir8.None), color);
                    }
                }
            }
        }