public ExitMenuOverlay(Action affirmationAction, Action refutationAction) : base(ID)
        {
            _background = new SolidRectangleContext(new RGBA(0, 0, 0, 150))
            {
                RenderSize = ServiceProvider.Canvas.GetResolution(),
                UseUIView  = true
            };

            var affirmationButton = new AffirmationButton("affirmationButton")
            {
                Visible          = true,
                Font             = { Value = Fonts.Default },
                ImageTextureName = { Value = "buttons/yes.png" },
                Position         = { X = 40, Y = 100 },
                Size             = { X = 40, Y = 40 },
                OnClickHandler   = affirmationAction
            };

            var refutationButton = new RefutationButton("refutationButton")
            {
                Visible          = true,
                Font             = { Value = Fonts.Default },
                ImageTextureName = { Value = "buttons/no.png" },
                Position         = { X = 100, Y = 100 },
                Size             = { X = 40, Y = 40 },
                OnClickHandler   = refutationAction
            };

            AddChild(affirmationButton);
            AddChild(refutationButton);
        }
 public ButtonsBackground()
 {
     this._rectangleContext = new SolidRectangleContext(RGBA.Purple)
     {
         RenderPosition    = Vector.Create(1, 0),
         RenderBorderColor = RGBA.White,
         RenderBorderSize  = 1.5f,
         RenderSize        = Vector.Create(1000, 30)
     };
 }
Exemple #3
0
 public Placeholder()
 {
     this._rectangleContext = new SolidRectangleContext(RGBA.Purple)
     {
         RenderPosition    = Vector.Create(900, 0),
         RenderBorderColor = RGBA.White,
         RenderBorderSize  = 1.5f,
         RenderSize        = Vector.Create(100, 650)
     };
 }
Exemple #4
0
 public Menu()
 {
     this._rectangleContext = new SolidRectangleContext(RGBA.Purple)
     {
         RenderPosition    = Vector.Create(350, 50),
         RenderBorderColor = RGBA.Black,
         RenderBorderSize  = 1.5f,
         RenderSize        = Vector.Create(300, 500)
     };
 }
Exemple #5
0
        public BoxCollisionEntity(float width, float height)
        {
            this.Width  = width;
            this.Height = height;

            this._box = new SolidRectangleContext(RGBA.Red)
            {
                RenderSize     = Vector.Create(Width, Height),
                RenderPosition = this.Position
            };
        }
Exemple #6
0
        public HitboxEntity(Vector position, uint left, uint top, uint right, uint bottom) : base(position)
        {
            this._left   = left;
            this._top    = top;
            this._right  = right;
            this._bottom = bottom;

            this._hitboxSprite = new SolidRectangleContext(new RGBA(255, 0, 0, 150))
            {
                RenderPosition = new OffsetVector(this.Position, -left, -top),
                RenderSize     = Vector.Create(left + right, top + bottom)
            };
        }
        public Enemy() : base(10, 10, 10, 10)
        {
            this.Size = Vector.Create(32, 32);

            var healthbarSize = Vector.Create(50, 5);

            this._greenHealthbar = new SolidRectangleContext(RGBA.Green)
            {
                RenderSize        = new ScalingVector(healthbarSize, Vector.Create(this.Health.GetPureRatio(), 1)),
                RenderBorderColor = RGBA.Black,
                RenderBorderSize  = 2,
                //-25 + 0, -30 -10
                RenderPosition = new OffsetVector(Position, new OffsetVector(new ScalingVector(healthbarSize, -0.5f, -1), new ScalingVector(Size, 0, -1)))
            };
            this._redHealthbar = new SolidRectangleContext(RGBA.Red)
            {
                RenderSize        = healthbarSize,
                RenderBorderColor = RGBA.Black,
                RenderBorderSize  = 2,
                RenderPosition    = new OffsetVector(Position, new OffsetVector(new ScalingVector(healthbarSize, -0.5f, -1), new ScalingVector(Size, 0, -1)))
            };

            this.EntityType = EntityType.Enemy;
            Random random = new Random();
            //Generates a random position for the enemy
            var positionX = random.Next(positionXLowerBound, positionXHigherBound);
            var positionY = random.Next(positionYLowerBound, positionYHigherBound);


            //Generates a random speed for the enemy
            int speed = random.Next(enemyMovementSpeedLowerBound, enemyMovementSpeedHigherBound);

            this.enemyMovementSpeed = speed;

            Position.X = positionX;
            Position.Y = positionY;


            if (RNG.Next(100) < 10)
            {
                IsAnt                   = true;
                this._sprite            = GetAntSprite(this.Position, this.Size);
                this.enemyMovementSpeed = enemyMovementSpeedLowerBound;
            }
            else
            {
                IsAnt        = false;
                this._sprite = GetEnemySprite(this.Position, this.Size);
            }
        }
 public DebugOverlay() : base(ID)
 {
     this._background = new SolidRectangleContext(new RGBA(0, 0, 0, 150))
     {
         RenderSize = Vector.Create(GameWindow.RESOLUTION_WIDTH, GameWindow.RESOLUTION_HEIGHT),
         UseUIView  = true
     };
     this._information = new TextContext("", "default.ttf")
     {
         FontSize        = 16,
         BorderColor     = RGBA.Black,
         BorderThickness = 2,
         FontColor       = RGBA.White,
         UseUIView       = true
     };
 }
Exemple #9
0
 public DebugOverlay() : base(ID)
 {
     this._background = new SolidRectangleContext(new RGBA(0, 0, 0, 150))
     {
         RenderSize = ServiceProvider.Canvas.GetResolution(),
         UseUIView  = true
     };
     this._information = new TextContext("", "default.ttf")
     {
         FontSize        = 16,
         BorderColor     = RGBA.Black,
         BorderThickness = 2,
         FontColor       = RGBA.White,
         UseUIView       = true
     };
 }
        public void Draw(SolidRectangleContext rectangle)
        {
            this.UpdateView(rectangle);

            var shape = new RectangleShape {
                Size      = rectangle.RenderSize,
                Position  = rectangle.RenderPosition,
                FillColor = rectangle.RenderFillColor
            };

            if (rectangle.RenderBorderColor != null && rectangle.RenderBorderSize != 0)
            {
                shape.OutlineColor     = rectangle.RenderBorderColor;
                shape.OutlineThickness = rectangle.RenderBorderSize;
            }

            this._buffer.Draw(shape);
        }
Exemple #11
0
        public ConversationMessage(ActiveConversationDialog dialog) : base(string.Empty)
        {
            dialog.OnActiveConversationDialogChanged += this.Dialog_OnActiveConversationDialogChanged;

            this._background = new SolidRectangleContext(new RGBA(150, 150, 150));
            this._background.RenderPosition.Set(new OffsetVector(dialog.Position, dialog.Size.Y, 0));
            this._background.RenderSize.Set(dialog.Size.X - dialog.Size.Y, Height);

            this._message = new TextContext(string.Empty, Fonts.Default);
            this._message.RenderPosition.Set(this._background.RenderPosition);
            this._message.FontColor.Set(RGBA.White);
            this._message.FontSize.Set(18);
            this._message.BorderColor.Set(RGBA.Black);
            this._message.BorderThickness = 3f;
            this._message.Alignment       = new TextAlignment()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Middle,
                Size = this._background.RenderSize
            };
        }