Esempio n. 1
0
        public void Draw(SpriteBatch spriteBatch, Vector2 cCircle)
        {
            if (listRoad.Count != 0)
            {
                for (int i = 0; i < listRoad.Count - 1; i++)
                {
                    Vector2 vTemp = listRoad[i + 1] - listRoad[i];

                    if (vTemp.X > 0)
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Jamb),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) + new Vector2(17, 17), Color.White);
                    }
                    else if (vTemp.X < 0)
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Jamb),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) - new Vector2(-17, 17), Color.White);
                    }
                    else if (vTemp.Y > 0)
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Crossroad),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) + new Vector2(17, 17), Color.White);
                    }
                    else
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Crossroad),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) - new Vector2(17, -17), Color.White);
                    }
                }
            }
        }
Esempio n. 2
0
        public void Draw(SpriteBatch spriteBatch, int iRoad)
        {
            if (listAllRoad.Count > 0)
            {
                for (int i = iRoad * (iSteps - 1); i < (iSteps - 1) + (iRoad * (iSteps - 1)); i++)
                {
                    listRoad.Add(listAllRoad[i]);
                }

                for (int i = 0; i < listRoad.Count - 1; i++)
                {
                    Vector2 vTemp = listRoad[i + 1] - listRoad[i];

                    if (vTemp.X > 0)
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Jamb),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) + new Vector2(17, 17), Color.White);
                    }
                    else if (vTemp.X < 0)
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Jamb),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) - new Vector2(-17, 17), Color.White);
                    }
                    else if (vTemp.Y > 0)
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Crossroad),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) + new Vector2(17, 17), Color.White);
                    }
                    else
                    {
                        spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Crossroad),
                                         MainGame.CoordinateTransfor((int)listRoad[i].X, (int)listRoad[i].Y) - new Vector2(17, -17), Color.White);
                    }
                }

                spriteBatch.DrawString(TextureManager.GetSpriteFont(ESpriteFont.FontNormal),
                                       (listAllRoad.Count / (iSteps - 1)).ToString(), new Vector2(500f, 40f),
                                       Color.Black, 0.0f,
                                       new Vector2(
                                           TextureManager.GetSpriteFont(ESpriteFont.FontMenu).MeasureString(iSteps.ToString()).X / 2,
                                           TextureManager.GetSpriteFont(ESpriteFont.FontMenu).MeasureString(iSteps.ToString()).Y / 2),
                                       1f, SpriteEffects.None, 0.0f);

                spriteBatch.DrawString(TextureManager.GetSpriteFont(ESpriteFont.FontNormal),
                                       iRoad.ToString(), new Vector2(790, 40f),
                                       Color.Black, 0.0f,
                                       new Vector2(
                                           TextureManager.GetSpriteFont(ESpriteFont.FontMenu).MeasureString(iRoad.ToString()).X / 2,
                                           TextureManager.GetSpriteFont(ESpriteFont.FontMenu).MeasureString(iRoad.ToString()).Y / 2),
                                       1f, SpriteEffects.None, 0.0f);

                listRoad.Clear();
            }
        }