public Tilemap(Node parent, string name, Texture2D tileTexture, Point size, Point tileSize) : base(parent, name) { Body = new Body(this, "Body"); Render = new TilemapRender(this, "TilemapRender", tileTexture, size, tileSize); Render.LinkDependency(TilemapRender.DEPENDENCY_BODY, Body); }
public CameraNode(State stateref, string name) : base(stateref, name) { Body = new Body(this, "Body", new Vector2(EntityGame.Viewport.Width / 2f, EntityGame.Viewport.Height / 2f)); Image = new ImageRender(this, "Image", Assets.Pixel); Image.LinkDependency(ImageRender.DEPENDENCY_BODY, Body); Image.Scale = new Vector2(50, 100); Image.Color = Color.Red; }
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 AnimationTestNode(State stateref, string name) : base(stateref, name) { Body = new Body(this, "Body"); Body.Position = new Vector2(100, 400); StandingAnim = new SourceAnimation(this, "StandingAnim", EntityGame.Self.Content.Load<Texture2D>(@"SourceAnimationTest/scott"), new Vector2(36, 59), 8); StandingAnim.LinkDependency(SourceAnimation.DEPENDENCY_BODY, Body); StandingAnim.Scale = Vector2.One; StandingAnim.ReadXml(@"States\SourceRectangleTest\standing.xml"); StandingAnim.Start(); StandingAnim.Debug = true; }
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); }
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); }
protected Control(Node parent, string name) : base(parent, name) { Visible = true; Body = new Body(this, "Body"); //Add our service if we have a parent, if not, we will let them update and draw if (parent != null && parent.GetType() != typeof (ControlHandler)) { ControlHandler = GetRoot<State>().GetService<ControlHandler>(); if (ControlHandler == null) { EntityGame.Log.Write("ControlHandler was not found! Cannot attach to Service", this, Alert.Error); //throw new Exception("ControlHandler was not found!"); } } else if (parent != null && parent.GetType() == typeof(ControlHandler)) { ControlHandler = parent as ControlHandler; } }
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; }
/// <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 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 void FollowPoint(Body b) { Target = b; FollowType = FollowStyle.LockOn; }
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 AsteroidGhost(Node parent, string name) : base(parent, name) { Body = new Body(this, "Body"); Render = new ImageRender(this, "Render"); Render.SetTexture(GetRoot<State>().GetService<AssetCollector>().GetAsset<Texture2D>("circle")); Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body); Collision = new Collision(this, "Collision"); Collision.Pair.AddMask(0); Collision.Pair.AddMask(1); Collision.Pair.AddMask(2); Collision.Group.AddMask(3); }
public Body Clone() { var b = new Body(Parent, Name); b.Position = Position; b.Angle = Angle; return b; }
public Cursor(Node parent, string name) : base(parent, name) { Active = true; Visible = false; Body = new Body(this, "Body"); Body.Position = new Vector2(400, 300); //Default rendering is a single white pixel. Render = new ImageRender(this, "ImageRender", Assets.Pixel); Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body); Render.Layer = 1f; Render.Scale = Vector2.One * 3f; Render.Color = Color.Black; Body.Bounds = Render.Scale; }
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; }
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 ParticleTestManager(State stateref) : base(stateref, "ParticleTestManager") { _controlHandler = stateref.GetService<ControlHandler>(); _body = new Body(this, "EmitterBody"); Spawner = new TestSpawner(this, "Spawner"); _moveCursor = new GamePadAnalog(this, "MoveCursor", Sticks.Left, PlayerIndex.One); _emitButton = new GamepadInput(this, "EmitButton", Buttons.B, PlayerIndex.One); }
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; }