Пример #1
0
            public override void Draw(DrawBatch drawBatch, float thickness, Color color)
            {
                Vector2 first, second;

                if (!useAngles)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        first  = Position + Extensions.GetVector2(i * 2 * (float)Math.PI / 10, vector4.Z);
                        second = Position + Extensions.GetVector2((i + 1) * 2 * (float)Math.PI / 10, vector4.Z);

                        Game1.DrawLine(drawBatch, first, second, thickness, color, DrawBatch.CalculateDepth(Position));
                    }
                }
                else
                {
                    for (int i = 0; i < 10; i++)
                    {
                        float activeLength = activeArea.Y - activeArea.X;

                        first  = Position + Extensions.GetVector2(activeArea.X + i * activeLength / 10, vector4.Z);
                        second = Position + Extensions.GetVector2(activeArea.X + (i + 1) * activeLength / 10, vector4.Z);

                        Game1.DrawLine(drawBatch, first, second, thickness, color, DrawBatch.CalculateDepth(Position));
                    }

                    Game1.DrawLine(drawBatch, Position, Position + Extensions.GetVector2(activeArea.X, vector4.Z), thickness, color, DrawBatch.CalculateDepth(Position));
                    Game1.DrawLine(drawBatch, Position, Position + Extensions.GetVector2(activeArea.Y, vector4.Z), thickness, color, DrawBatch.CalculateDepth(Position));
                }
            }
Пример #2
0
        public virtual void DrawName(DrawBatch drawBatch, float scale)
        {
            Vector2 measurements = (Game1.fontDebug.MeasureString(item.name) * scale);
            float   depth        = DrawBatch.CalculateDepth(PositionXY);

            drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)(position.X - measurements.X / 2), (int)(position.Y + 20 - position.Z - measurements.Y / 2), (int)measurements.X, (int)measurements.Y), Color.DarkBlue, depth);
            drawBatch.DrawString(DrawBatch.DrawCall.Tag.GameObject, item.name, Game1.fontDebug, new Vector2(position.X, position.Y + 20 - position.Z), scale, 0f, measurements / 2, Color.White, depth);
        }
Пример #3
0
        private void DrawHUD()
        {
            //Draw HUD here
            spriteBatch.DrawString(fontDebug, "Selected: " + SelectionHandler.selectedTile.ToString(), new Vector2(20, 40), Color.White);
            spriteBatch.DrawString(fontDebug, "Rect: " + SelectionHandler.TileRectangle.ToString(), new Vector2(20, 80), Color.White);
            spriteBatch.DrawString(fontDebug, "Second: " + SelectionHandler.selectedTileSecond.ToString(), new Vector2(20, 120), Color.White);


            spriteBatch.DrawString(fontDebug, "Select Target: " + SelectionHandler.CurrentTarget.ToString(), new Vector2(20, 140), Color.White);
            spriteBatch.DrawString(fontDebug, "SelectionRect: " + SelectionHandler.SelectionRectangle.ToString(), new Vector2(20, 180), Color.White);
            spriteBatch.DrawString(fontDebug, "Selected: " + SelectionHandler.selectionPoint.ToString(), new Vector2(20, 200), Color.White);
            spriteBatch.DrawString(fontDebug, "Second: " + SelectionHandler.selectionPointSecond.ToString(), new Vector2(20, 220), Color.White);
            spriteBatch.DrawString(fontDebug, "MouseTile: " + mouseTile.ToString(), new Vector2(20, 260), Color.White);
            spriteBatch.DrawString(fontDebug, "MousePosInWrld: " + mousePosInWorld.ToString(), new Vector2(20, 280), Color.White);
            spriteBatch.DrawString(fontDebug, "Cam.pos: " + camera.pos.ToString(), new Vector2(20, 320), Color.White);
            spriteBatch.DrawString(fontDebug, "Cam.Position: " + camera.Position.ToString(), new Vector2(20, 340), Color.White);

            spriteBatch.DrawString(fontDebug, "MouseDepth: " + DrawBatch.CalculateDepth(mousePosInWorld).ToString(), new Vector2(20, 380), Color.Red);
            spriteBatch.DrawString(fontDebug, "Drawcalls: " + drawBatch.DrawCallCount.ToString(), new Vector2(20, 400), Color.Red);

            spriteBatch.DrawString(fontDebug, "Average Time per Frame: " + millisecondsPerFrameAverage, new Vector2(20, 450), Color.Red);

            spriteBatch.DrawString(fontDebug, "Average Time per Frame (Upd): " + millisecondsPerFrameAverageUpdate, new Vector2(20, 480), Color.Red);
            spriteBatch.DrawString(fontDebug, "Average Time per Frame (Drw): " + millisecondsPerFrameAverageDraw, new Vector2(20, 500), Color.Red);

            spriteBatch.DrawString(fontDebug, "Time Budget Total: " + millisecondBudget, new Vector2(20, 550), Color.Red);
            spriteBatch.DrawString(fontDebug, "Time Budget Left: " + (millisecondBudget - millisecondsPerFrameAverage), new Vector2(20, 580), Color.Red);

            spriteBatch.DrawString(fontDebug, "AbilityHandler: ", new Vector2(400, 450), Color.Red);
            int i = 0;

            foreach (var item in ((Player)agents[0]).abilityHandler.executers)
            {
                spriteBatch.DrawString(fontDebug, i.ToString() + ": " + item.Value.type + ", " + item.Value.Ready, new Vector2(400, 480), Color.Red);
                i++;
            }
            spriteBatch.DrawString(fontDebug, "Time Budget Left: " + (millisecondBudget - millisecondsPerFrameAverage), new Vector2(20, 580), Color.Red);

            //if (agents.Count > 1)
            //    drawBatch.DrawString(fontDebug, "Colliding Circles: " + agents[0].collider.CollisionCheck(agents[1].collider, false), new Vector2(20, 320), Color.White);

            GUI.Draw(spriteBatch);

            spriteBatch.Draw(pixel, new Rectangle((int)(mouseState.X * ((float)screenWidth / displayWidth)) - 2, (int)(mouseState.Y * ((float)screenHeight / displayHeight)) - 2, 4, 4), Color.Brown);
        }
Пример #4
0
        public override void Draw(DrawBatch drawBatch)
        {
            if (SelectionHandler.selectedID == ID)
            {
                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.Blue, DrawBatch.CalculateDepth(PositionXY));
            }
            else if (tag == Tag.Enemy)
            {
                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.Red, DrawBatch.CalculateDepth(PositionXY));
            }
            else if (tag == Tag.Player)
            {
                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.White, DrawBatch.CalculateDepth(PositionXY));
            }

            drawBatch.DrawString(DrawBatch.DrawCall.Tag.GameObject, GetCurrentHealth().ToString(), Game1.fontDebug, PositionXY - new Vector2(10), Color.Red, DrawBatch.CalculateDepth(PositionXY));

            healthBar.drawRectangle = new Rectangle((int)(position.X - 16), (int)(position.Y + 10), 32, 8);

            healthBar.Draw(DrawBatch.DrawCall.Tag.GameObject, drawBatch, DrawBatch.CalculateDepth(PositionXY), (short)2, 0f);

            //collider.Draw(spriteBatch, 2f, Color.Cyan);
        }
Пример #5
0
        private void DrawLights()
        {
            drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, new Vector2(150, 100), Color.Orange, DrawBatch.CalculateDepth(new Vector2(150, 100)));
            drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, new Vector2(570, 290), Color.Cyan, DrawBatch.CalculateDepth(new Vector2(570, 290)));
            drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, new Vector2(344, 320), Color.Purple, DrawBatch.CalculateDepth(new Vector2(344, 320)));

            if (KeyDown(Keys.F))
            {
                drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, mousePosInWorld, new Vector2(2, 2), 0f, new Vector2(128), Color.White, DrawBatch.CalculateDepth(mousePosInWorld));
            }
        }
Пример #6
0
 public override void Draw(DrawBatch drawBatch)
 {
     if (sprite != null)
     {
         sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), 0f, sprite.Measurements.ToVector2() / 2, scale, DrawBatch.CalculateDepth(PositionXY));
     }
 }
Пример #7
0
            public override void Draw(DrawBatch drawBatch)
            {
                Color newColor = Color.Lerp(color, Color.Transparent, MathTransformations.Transform(MathTransformations.Type.NormalizedSmoothStart2, timeAlive / (float)timeToLive) + .4f);

                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)(PositionXY.X - 1 * scale), (int)((position.Y - position.Z) - 1 * scale), (int)(2 * scale), (int)(2 * scale)), new Rectangle(0, 0, 1, 1), newColor, DrawBatch.CalculateDepth(PositionXY), (short)2, 1);
                drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, new Vector2(PositionXY.X, PositionXY.Y - position.Z), .35f * scale, 0f, new Vector2(Game1.fader.Width * .5f), Color.Lerp(newColor, Color.DarkGray, .05f), DrawBatch.CalculateDepth(PositionXY));

                base.Draw(drawBatch);
            }
Пример #8
0
 public override void Draw(DrawBatch drawBatch, float thickness, Color color)
 {
     Game1.DrawLine(drawBatch, new Vector4(Position.X, Position.Y, Position.X + Width, Position.Y), thickness, color, DrawBatch.CalculateDepth(Position));
     Game1.DrawLine(drawBatch, new Vector4(Position.X + Width, Position.Y, Position.X + Width, Position.Y + Height), thickness, color, DrawBatch.CalculateDepth(Position));
     Game1.DrawLine(drawBatch, new Vector4(Position.X + Width, Position.Y + Height, Position.X, Position.Y + Height), thickness, color, DrawBatch.CalculateDepth(Position));
     Game1.DrawLine(drawBatch, new Vector4(Position.X, Position.Y + Height, Position.X, Position.Y), thickness, color, DrawBatch.CalculateDepth(Position));
 }
Пример #9
0
        public virtual void Draw(DrawBatch drawBatch)
        {
            sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY));

            if (hasLight)
            {
                SpriteLights.Draw(drawBatch, DrawBatch.DrawCall.Tag.Light, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY) - .0000001f);
            }
            if (sprite.Finished)
            {
                remove = true;
            }
        }
Пример #10
0
            public override void Draw(DrawBatch drawBatch)
            {
                sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY));
                //sprite.frame -= sprite.speed;
                //sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.Light, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY) + .01f);

                if (hasLight)
                {
                    SpriteLights.Draw(drawBatch, DrawBatch.DrawCall.Tag.Light, PositionXY + new Vector2(0, -position.Z), rotation, origin * 2, scale * 2, Color.Lerp(Color.LightGoldenrodYellow, Color.OrangeRed, sprite.frame / sprite.frames), DrawBatch.CalculateDepth(PositionXY) + .01f);
                }

                base.Draw(drawBatch);
            }
Пример #11
0
        public override void Draw(DrawBatch drawBatch)
        {
            if (SelectionHandler.TileObjectsContains(Position))
            {
                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, (hitBox.Location.ScaleRet(World.tileSize) + new Point(World.tileSize / 2) - origin).ToVector2(), Color.Red, DrawBatch.CalculateDepth(new Vector2(Position.X * 16 + 8, Position.Y * 16 + 8)));
            }
            else
            {
                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, (hitBox.Location.ScaleRet(World.tileSize) + new Point(World.tileSize / 2) - origin).ToVector2(), Color.White, DrawBatch.CalculateDepth(new Vector2(Position.X * 16 + 8, Position.Y * 16 + 8)));
            }

            base.Draw(drawBatch);
        }
Пример #12
0
        public override void Draw(DrawBatch drawBatch)
        {
            drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)PositionXY.X - 3, (int)(position.Y - position.Z) - 3, 6, 6), Color.Purple, DrawBatch.CalculateDepth(PositionXY));
            drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, new Vector2(PositionXY.X, PositionXY.Y), .2f, 0f, new Vector2(Game1.fader.Width * .5f), Color.Purple, DrawBatch.CalculateDepth(PositionXY));

            base.Draw(drawBatch);
        }
Пример #13
0
 public override void Draw(DrawBatch drawBatch)
 {
     sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), DrawBatch.CalculateDepth(PositionXY));
 }
Пример #14
0
 public override void Draw(DrawBatch drawBatch)
 {
     sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0), 0f, new Vector2(16, 16), new Vector2(.5f), Color.Lerp(Color.Black, Color.Transparent, .5f), DrawBatch.CalculateDepth(PositionXY));
     if (nextFrameRed)
     {
         sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), MovementXY.GetAngle(), new Vector2(16, 16), new Vector2(.5f), Color.Red, DrawBatch.CalculateDepth(PositionXY));
         nextFrameRed = false;
     }
     else
     {
         sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), MovementXY.GetAngle(), new Vector2(16, 16), .5f, DrawBatch.CalculateDepth(PositionXY));
     }
 }
Пример #15
0
            public override void Draw(DrawBatch drawBatch)
            {
                float flack = (float)Math.Cos(timeAlive / 4.3f);

                //sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0), MovementXY.GetAngle(), new Vector2(56, 16), new Vector2(.5f), Color.Lerp(Color.Black, Color.Transparent, .5f), DrawBatch.CalculateDepth(PositionXY));
                sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), MovementXY.GetAngle(), new Vector2(56, 16), DrawBatch.CalculateDepth(PositionXY));

                drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, PositionXY + new Vector2(0, -position.Z), Extensions.LerpFloat(.3f, .6f, flack * flack), 0f, new Vector2(Game1.fader.Width / 2, Game1.fader.Height / 2), Color.Lerp(Color.OrangeRed, new Color(240, 220, 0), .1f + flack * .8f), DrawBatch.CalculateDepth(PositionXY) + .0001f);
                drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, PositionXY + new Vector2(0, -position.Z), .6f, 0f, new Vector2(Game1.fader.Width / 2, Game1.fader.Height / 2), Color.Lerp(Color.LightGoldenrodYellow, Color.Black, .4f), DrawBatch.CalculateDepth(PositionXY) + .0001f);
            }
Пример #16
0
 public override void Draw(DrawBatch drawBatch, float thickness, Color color)
 {
     drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, Position, thickness, 0f, new Vector2(.5f), color, DrawBatch.CalculateDepth(Position));
 }
Пример #17
0
 public override void Draw(DrawBatch drawBatch, float thickness, Color color)
 {
     Game1.DrawLine(drawBatch, vector4, thickness, color, DrawBatch.CalculateDepth(Position));
 }
Пример #18
0
 public override void Draw(DrawBatch drawBatch)
 {
     DrawName(drawBatch, .6f);
     item.DrawIcon(drawBatch, new Rectangle(PositionXY.ToPoint() - new Point(8), new Point(16)), DrawBatch.CalculateDepth(PositionXY));
     base.Draw(drawBatch);
 }
Пример #19
0
            public override void Draw(DrawBatch drawBatch, float orientation, string selectedLimb, Vector2 offset, float depth)
            {
                drawPos = new Vector2(position.X, position.Y);

                drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)position.X, (int)position.Y, 4, 4), Color.AliceBlue, DrawBatch.CalculateDepth(new Vector2(position.X, position.Y)));

                Dictionary <string, Vector4> lines = Get2DLines(orientation);
                Vector4 value;

                foreach (KeyValuePair <string, Vector4> pair in lines)
                {
                    value = new Vector4(pair.Value.X + drawPos.X + offset.X, pair.Value.Y + drawPos.Y + offset.Y, pair.Value.Z + drawPos.X + offset.X, pair.Value.W + drawPos.Y + offset.Y);
                    if ("X" == pair.Key)
                    {
                        Game1.DrawLine(drawBatch, value, 3f, Color.Blue, 0f);
                    }
                    else if ("Y" == pair.Key)
                    {
                        Game1.DrawLine(drawBatch, value, 3f, Color.Red, 0f);
                    }
                    else if ("Z" == pair.Key)
                    {
                        Game1.DrawLine(drawBatch, value, 3f, Color.Green, 0f);
                    }
                }
            }
Пример #20
0
 public override void Draw(DrawBatch drawBatch)
 {
     rig.Draw(drawBatch, orientation, "Neck", new Vector2(0, -16), DrawBatch.CalculateDepth(PositionXY));
     base.Draw(drawBatch);
 }