Exemplo n.º 1
0
        public Button(Node parent, string name, Vector2 position, Vector2 bounds, RGBColor color) : base(parent, name)
        {
            Body.Position = position;
            Body.Bounds   = bounds;


            //Make our rectangles
            _bodyImage = new ShapeTypes.Rectangle(this, "BodyImage", true);
            _bodyImage.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
            _bodyImage.Color = color;
        }
Exemplo n.º 2
0
                public TrailParticle(Node parent, int ttl)
                    : base(parent, ttl)
                {
                    Body        = new Body(this, "Body");
                    Body.Origin = new Vector2(.5f, .5f);

                    Physics = new Physics(this, "Physics");
                    Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                    Render = new ShapeTypes.Rectangle(this, "Render", true);
                    Render.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
                    Render.Color = Color.OrangeRed;

                    DeathTimer.LastEvent += () => Destroy();
                }
Exemplo n.º 3
0
                    public GibSpawn(Node parent)
                        : base(parent, 3000)
                    {
                        FadeAge = TimeToLive / 5 * 4;
                        Body    = new Body(this, "Body");
                        Physics = new Physics(this, "Physics");
                        Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                        RectRender = new ShapeTypes.Rectangle(this, "RectRender", true);
                        RectRender.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);

                        Render = RectRender;

                        DeathTimer.LastEvent += Recycle;
                    }
Exemplo n.º 4
0
                public ExplodingSpawn(Node parent, int ttl, Color color)
                    : base(parent, ttl)
                {
                    Body    = new Body(this, "Body");
                    Physics = new Physics(this, "Physics");
                    Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                    RectRender = new ShapeTypes.Rectangle(this, "RectRender", true);
                    RectRender.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
                    RectRender.Color = color;

                    GibEmit = new GibSpawner(this, "GibSpawner", color);
                    GibEmit.LinkDependency(GibSpawner.DEPENDENCY_BODY, Body);
                    GibEmit.LinkDependency(GibSpawner.DEPENDENCY_PHYSICS, Physics);
                }
Exemplo n.º 5
0
            public AABBTester(Node parent, string name, float width = 20, float height = 20)
                : base(parent, name)
            {
                AABB = new AABB(this, "AABB");
                AABB.LinkDependency(AABB.DEPENDENCY_BODY, Body);
                AABB.LinkDependency(AABB.DEPENDENCY_COLLISION, Collision);

                Body.Width  = width;
                Body.Height = height;

                Render = new ShapeTypes.Rectangle(this, "Render", true);
                Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
                Body.Origin = new Vector2(.5f); //Half of a pixel since that is the size of the brush.

                Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, AABB);
            }
Exemplo n.º 6
0
        public SimpleBar(Node parent, string name, Body body) : base(parent, name)
        {
            _bgBarBody = body;
            _fgBarBody = new Body(this, "FGBarBody");

            _fgBarBody.X      = body.X;
            _fgBarBody.Y      = body.Y;
            _fgBarBody.Height = body.Height;
            _fgBarBody.Width  = body.Width;

            _fgBar = new ShapeTypes.Rectangle(this, "FGBar", true);
            _fgBar.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, _fgBarBody);

            _bgBar = new ShapeTypes.Rectangle(this, "BGBar", true);
            _bgBar.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, _bgBarBody);
        }
Exemplo n.º 7
0
            public SpinningRect(Node parent, string name, float x, float y, float width, float height, bool fill = false, float thickness = 3)
                : base(parent, name)
            {
                Body.X      = x;
                Body.Y      = y;
                Body.Width  = width;
                Body.Height = height;
                Body.Origin = new Vector2(.5f / thickness, .5f / thickness);

                Rectangle = new ShapeTypes.Rectangle(this, "Rectangle", fill);
                Rectangle.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);

                //Rectangle.Origin = fill ? new Vector2(Body.Width / 2f, Body.Height / 2f) : new Vector2(.5f, .5f);
                Rectangle.Thickness = thickness;
                Rectangle.Debug     = false;
            }
                    public TestSpawn(Node parent)
                        : base(parent, 2000)
                    {
                        Body        = new Body(this, "Body");
                        Body.Origin = new Vector2(.5f, .5f);

                        Physics = new Physics(this, "Physics");
                        Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                        RectRender = new ShapeTypes.Rectangle(this, "RectRender", RandomHelper.RandomBool());
                        RectRender.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);

                        RectRender.Thickness = 1;
                        Render  = RectRender;
                        FadeAge = 1000;

                        DeathTimer.LastEvent += Recycle;
                    }
Exemplo n.º 9
0
            public ParticleNode(Node parent, string name)
                : base(parent, name)
            {
                Body        = new Body(this, "Body");
                Body.Width  = 10;
                Body.Height = 10;
                Body.Y      = OffsetY;

                Physics = new Physics(this, "Physics");
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Render = new ShapeTypes.Rectangle(this, "Render", true);
                Render.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
                Render.Color = Color.OrangeRed;

                _emitter = new ParticleEmitter(this, "Emitter");
                _emitter.LinkDependency(ParticleEmitter.DEPENDENCY_BODY, Body);
            }
Exemplo n.º 10
0
        public TextButton(Node parent, string name, Vector2 position, RGBColor color) : base(parent, name)
        {
            Body.Position = position;

            _textBody  = new Body(this, "TextBody");
            TextRender = new TextRender(this, "Render", Assets.Font, "");
            TextRender.LinkDependency(TextRender.DEPENDENCY_BODY, _textBody);
            TextRender.Layer = .9f;

            //Start setting up Render's body
            _textBody.Bounds = TextRender.Bounds;
            Body.Bounds      = TextRender.Bounds + Spacing;

            _textBody.Position = new Vector2(Body.Position.X + Body.Bounds.X / 2 - _textBody.Bounds.X / 2,
                                             Body.Position.Y + Body.Bounds.Y / 2 - _textBody.Bounds.Y / 2);

            //Make our rectangles
            _bodyImage = new ShapeTypes.Rectangle(this, "BodyImage", true);
            _bodyImage.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
            _bodyImage.Color = color;
        }