Esempio n. 1
0
        public Shape DisplayField(Tile tile)
        {
            CircleShape arrField = new CircleShape(3);

            arrField.Position = new Vector2f((float)tile.X + 250, (float)tile.Y + 250);

            if (tile.Obstacle != "None")
            {
                arrField.SetPointCount(6);
                switch (tile.Obstacle)
                {
                case "Rock":
                    arrField.FillColor = new Color(195, 180, 157);
                    break;

                case "Tree":
                    arrField.FillColor = new Color(0, 67, 5);
                    break;

                case "River":
                    arrField.FillColor = new Color(30, 38, 129);
                    break;
                }
            }

            return(arrField);
        }
Esempio n. 2
0
        public static void DesenharCirculo(float x, float y, float raio, float points, byte r, byte g, byte b, float op)
        {
            CircleShape shape = new CircleShape();

            shape.FillColor = new Color(r, g, b, (byte)op);
            shape.Position  = new Vector2f(x, y);
            shape.Radius    = raio;
            shape.SetPointCount((uint)points);
            V.window.Draw(shape);
        }
Esempio n. 3
0
        public CircleRenderer(GameObject _parentGo, uint _radius, Color _color)
        {
            parentGameobject = _parentGo;;

            circle           = new CircleShape();
            circle.Origin    = new Vector2f(_radius, _radius);
            circle.Radius    = _radius;
            circle.Position  = parentGameobject.pos;
            circle.FillColor = _color;
            circle.SetPointCount(16);
            Game.ObjectRenderer.AddRenderedObject(circle);
        }
Esempio n. 4
0
        internal static CircleShape CreateShape(Unit unit, int size, uint point)
        {
            CircleShape shape = new CircleShape(size)
            {
                Position = new Vector2f((float)unit.Location.X + 250, (float)unit.Location.Y + 250),
            };

            shape.SetPointCount(point);
            Coloring(shape, unit);

            return(shape);
        }
Esempio n. 5
0
        /// <summary>
        /// Drawing of the Project Model. Can simply override and return a Sprite if need be.
        /// </summary>
        /// <returns></returns>
        public virtual dynamic GetProjectileModel()
        {
            float       radius = 10;
            CircleShape proj   = new CircleShape(radius);

            proj.Origin           = new Vector2f(radius, radius);
            proj.FillColor        = new Color(0, 0, 0, 0);
            proj.OutlineThickness = 2;
            proj.OutlineColor     = new Color(250, 250, 250);
            proj.SetPointCount(20);

            return(proj);
        }
Esempio n. 6
0
        public override void Render(RenderTarget buffer, Texture texture)
        {
            CircleShape shape = new CircleShape(Radius)
            {
                FillColor = Color
            };

            shape.SetPointCount((uint)FloorInt(Radius / 1.2f));
            shape.Position = Position - new Vector2f(Radius, Radius);

            buffer.Draw(shape);
            shape.Dispose();
        }
Esempio n. 7
0
        public AstralBody(Color color, Vector2f position, float size = 50)
        {
            this.position = position;

            this.color = color;
            this.size  = size;

            body           = new CircleShape(this.size);
            body.Origin    = new Vector2f(body.Radius, body.Radius);
            body.FillColor = this.color;
            body.Position  = position;

            body.SetPointCount(50);
        }
Esempio n. 8
0
        public Planet(Color color, float size = 10) : base(color, new Vector2f(0, 0), size)
        {
            this.color = color;
            this.size  = size;

            body           = new CircleShape(this.size);
            body.Origin    = new Vector2f(body.Radius, body.Radius);
            body.FillColor = this.color;
            body.Position  = position;

            orbitDisplay                  = new CircleShape();
            orbitDisplay.FillColor        = Color.Transparent;
            orbitDisplay.OutlineColor     = Color.White;
            orbitDisplay.OutlineThickness = 1f;
            orbitDisplay.SetPointCount(50);
        }
Esempio n. 9
0
        private void CircleInternal(RenderTarget target, float x, float y, float radius, uint color = 0, bool fill = false, uint pointCount = 0)
        {
            float       xf    = x - radius;
            float       yf    = y - radius;
            CircleShape shape = new CircleShape(radius);

            if (fill)
            {
                shape.FillColor = new Color(color);
            }
            else
            {
                shape.FillColor = Color.Transparent;
            }
            shape.OutlineThickness = 1.5f;
            shape.OutlineColor     = new Color(color);
            shape.Position         = new Vector2f(xf, yf);
            shape.SetPointCount(pointCount > 0 ? pointCount : shape.GetPointCount() * 2);
            target.Draw(shape);
        }
Esempio n. 10
0
        protected override void UpdateDrawable()
        {
            base.UpdateDrawable();

            if (isCircle)
            {
                var circle = new CircleShape(radius);
                circle.OutlineThickness = OutlineThickness;
                circle.OutlineColor     = OutlineColor.SFMLColor;
                circle.FillColor        = Color.SFMLColor;
                circle.SetPointCount((uint)CirclePointCount);
                SFMLDrawable = circle;
                Width        = (int)circle.GetLocalBounds().Width;
                Height       = (int)circle.GetLocalBounds().Height;
            }
            else
            {
                if (isShape)
                {
                    var rect = new RectangleShape(new Vector2f(rectWidth, rectHeight));
                    rect.OutlineColor     = OutlineColor.SFMLColor;
                    rect.OutlineThickness = OutlineThickness;
                    rect.FillColor        = Color.SFMLColor;
                    SFMLDrawable          = rect;
                    Width  = (int)rect.GetLocalBounds().Width;
                    Height = (int)rect.GetLocalBounds().Height;
                }
                else
                {
                    SFMLVertices.Clear();

                    float x1, y1, x2, y2, u1, v1, u2, v2, cx1, cy1, cx2, cy2;

                    cx1 = ClippingRegion.Left;
                    cy1 = ClippingRegion.Top;
                    cx2 = ClippingRegion.Right;
                    cy2 = ClippingRegion.Bottom;

                    x1 = Util.Max(0, cx1);
                    u1 = TextureLeft + x1;

                    if (FlippedX)
                    {
                        u1 = TextureRegion.Width - u1 + TextureLeft + TextureRegion.Left;
                    }

                    y1 = Util.Max(0, cy1);
                    v1 = TextureTop + y1;

                    if (FlippedY)
                    {
                        v1 = TextureRegion.Height - v1 + TextureTop + TextureRegion.Top;
                    }

                    x2 = Util.Min(TextureRegion.Right, cx2);
                    u2 = TextureLeft + x2;

                    if (FlippedX)
                    {
                        u2 = TextureRegion.Width - u2 + TextureLeft + TextureRegion.Left;
                    }

                    y2 = Util.Min(TextureRegion.Bottom, cy2);
                    v2 = TextureTop + y2;

                    if (FlippedY)
                    {
                        v2 = TextureRegion.Height - v2 + TextureTop + TextureRegion.Top;
                    }

                    SFMLVertices.Append(x1, y1, Color, u1, v1);
                    SFMLVertices.Append(x1, y2, Color, u1, v2);
                    SFMLVertices.Append(x2, y2, Color, u2, v2);
                    SFMLVertices.Append(x2, y1, Color, u2, v1);

                    Width  = TextureRegion.Width;
                    Height = TextureRegion.Height;
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Levels the Player Up: raises maximal Health and adds an Edge
 /// </summary>
 public static void LevelUp()
 {
     iLevel++;
     sCharacter.SetPointCount(iLevel);
     iHealthMax += 25;
 }
Esempio n. 12
0
        public void Start()
        {
            if (Started)
            {
                return;
            }
            Started = true;
            Running = true;

            // Background
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                RectangleShape Water = new RectangleShape(new Vector2f(Size.X, Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                Layer_Background.AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(this, new Vector2f(Size.X + 40, Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                Layer_Background.AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(this, new Vector2f(Size.X, Size.Y), 120, 10, new Color(80, 158, 228));
                Layer_Background.AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect      = new IntRect(0, 0, (int)Size.X, (int)Size.Y);
                Layer_Background.AddChild(BluePrintBackground);
            }

            // Island
            float IslandRadius = 240;

            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Sprite IslandTexture = Graphics.GetSprite("assets/sprites/island.png");
                IslandTexture.Origin   = new Vector2f(IslandRadius, IslandRadius);
                IslandTexture.Position = new Vector2f((Size.X / 2) + 1, (Size.Y / 2));
                Layer_Background.AddChild(IslandTexture);
            }

            Island          = new CircleShape(IslandRadius);
            Island.Origin   = new Vector2f(IslandRadius, IslandRadius);
            Island.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Island.FillColor        = new Color(0, 0, 10, 0);
                Island.OutlineThickness = 20;
                Island.OutlineColor     = new Color(138, 104, 0, 100);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Island.FillColor        = new Color(0, 0, 10, 30);
                Island.OutlineThickness = 2;
                Island.OutlineColor     = new Color(250, 250, 250);
            }
            Island.SetPointCount(80);
            Layer_Background.AddChild(Island);

            IslandWaves = new CircleWaves(this, IslandRadius, 0.1f, 1.5f, 6, 80);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                IslandWaves.Colour = new Color(80, 158, 228);
            }
            IslandWaves.Position = Island.Position;
            Layer_Background.AddChild(IslandWaves);

            // Hill
            float HillRadius = 30;

            Hill          = new CircleShape(HillRadius);
            Hill.Origin   = new Vector2f(HillRadius, HillRadius);
            Hill.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Hill.FillColor        = new Color(50, 50, 50, 150);
                Hill.OutlineThickness = 4;
                Hill.OutlineColor     = new Color(0, 0, 0, 215);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Hill.FillColor        = new Color(0, 0, 10, 50);
                Hill.OutlineThickness = 2;
                Hill.OutlineColor     = new Color(250, 250, 250);
            }
            Hill.SetPointCount(50);
            Layer_Background.AddChild(Hill);

            // Player (Cannon)
            Player = new Cannon(this);
            Player.SetPosition(Size.X / 2, Size.Y / 2);
            Layer_OtherAbove.AddChild(Player);
            Player.SetPlayer(true);

            // AI Manager
            AIManager = new AIManager(this);
            AIManager.StartWaveCountdown();

            // HUD
            HUD = new HeadsUpDisplay(this);
            HUD.SetHealth(Player.Health);
            Layer_GUI.AddChild(HUD);
        }