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); }
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); }
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); }
/// <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); }
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; }
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(); }
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); }
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; }
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; }
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; }