コード例 #1
0
        public BaseNode(Node parent, string name)
            : base(parent, name)
        {
            Body = new Body(this, "Body");

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

            Collision = new Collision(this, "Collision");
            Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);
        }
コード例 #2
0
ファイル: Physics.cs プロジェクト: sol-vin/EntityEngineV4
        public Physics Clone()
        {
            Physics p = new Physics(Parent, Name);

            p.AngularVelocity = AngularVelocity;
            p.AngularDrag     = AngularDrag;
            p.Drag            = Drag;
            p.Velocity        = Velocity;
            p.Acceleration    = Acceleration;
            p.LinkDependency(DEPENDENCY_BODY, GetDependency(DEPENDENCY_BODY));
            return(p);
        }
コード例 #3
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);
            }
コード例 #4
0
            /// <summary>
            /// /Creates a new AABBEntity
            /// </summary>
            /// <param name="stateref"></param>
            /// <param name="name"></param>
            public CollisionTestNode(State stateref, string name)
                : base(stateref, name)
            {
                Body = new Body(this, "Body");

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

                Collision = new Collision(this, "Collision");
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);

                ImageRender = new ImageRender(this, "Image", Assets.Pixel);
                ImageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

                TextBody = new Body(this, "TextBody");

                TextRender = new TextRender(this, "Render");
                TextRender.LinkDependency(TextRender.DEPENDENCY_BODY, TextBody);
            }
コード例 #5
0
            public ResolutionTestNode(State stateref, string name)
                : base(stateref, name)
            {
                Body = new Body(this, "Body");
                Body.Bounds = new Vector2(70, 70);

                _physics = new Physics(this, "_physics");
                _physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);
                _physics.Mass = 10f;
                _physics.Restitution = 1f;
                _physics.Drag = .95f;

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

                Collision = new Collision(this, "Collision");
                Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, _physics);
                Collision.Initialize();

                _imageRender = new ImageRender(this, "Image", Assets.Pixel);
                _imageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
                _imageRender.Scale = new Vector2(70, 70);
                _imageRender.Layer = .5f;

                _textBody = new Body(this, "_textBody");

                _textRender = new TextRender(this, "_textRender");
                _textRender.LinkDependency(TextRender.DEPENDENCY_BODY, _textBody);
                _textRender.Color = Color.White;
                _textRender.Font = Assets.Font;
                _textRender.Text = Name;
                _textRender.Layer = 1f;
            }
コード例 #6
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();
                }
コード例 #7
0
            public TestEntity(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");

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

                Collision = new Collision(this, "Collision");
                Collision.Group.AddMask(0);
                Collision.Pair.AddMask(0);
                Collision.ResolutionGroup.AddMask(0);
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);
            }
コード例 #8
0
                    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;
                    }
コード例 #9
0
ファイル: Physics.cs プロジェクト: HaKDMoDz/EntityEngineV4
 public Physics Clone()
 {
     Physics p = new Physics(Parent, Name);
     p.AngularVelocity = AngularVelocity;
     p.AngularDrag = AngularDrag;
     p.Drag = Drag;
     p.Velocity = Velocity;
     p.Acceleration = Acceleration;
     p.LinkDependency(DEPENDENCY_BODY, GetDependency(DEPENDENCY_BODY));
     return p;
 }
コード例 #10
0
            public PrimitiveTestNode(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");
                Physics = new Physics(this, "Physics");
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Physics.AngularVelocity = .01f;
            }