public Body Clone() { var b = new Body(Parent as Entity, Name); b.Position = Position; b.Angle = Angle; return b; }
public Text(EntityState stateref, IComponent parent, string name, SpriteFont font, string text, Vector2 position) : base(stateref,parent, name) { Body = new Body(this, "Body", position); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); TextRender = new TextRender(this, "TextRender", font, text); AddComponent(TextRender); }
public Text(EntityState stateref, IComponent parent, string name) : base(stateref, parent, name) { Body = new Body(this, "Body"); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); TextRender = new TextRender(this, "TextRender"); AddComponent(TextRender); }
public Image(EntityState stateref, IComponent parent, string name, Texture2D texture, Vector2 position) : base(stateref, parent, name) { Body = new Body(this, "Body", position); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); ImageBaseRender = new ImageRender(this, "ImageRender", texture); AddComponent(ImageBaseRender); }
public Image(EntityState stateref, IComponent parent, string name) : base(stateref, parent, name) { Body = new Body(this, "Body"); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); ImageBaseRender = new ImageRender(this, "ImageRender"); AddComponent(ImageBaseRender); }
public Bullet(EntityState stateref, string name) : base(stateref, name) { Body = new Body(this, "Body"); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); ImageRender = new ImageRender(this, "ImageRender"); ImageRender.LoadTexture(@"Asteroids/bullet"); ImageRender.Layer = .2f; AddComponent(ImageRender); }
public Ship(EntityState stateref, string name) : base(stateref, name) { Body = new Body(this, "Body", new Vector2(200,200)); AddComponent(Body); Physics = new Physics(this, "Physics"); Physics.Drag = 0.9f; AddComponent(Physics); ImageRender = new ImageRender(this, "ImageRender"); ImageRender.LoadTexture(@"Asteroids/ship-small"); ImageRender.Color = Color.White; ImageRender.Origin = new Vector2(ImageRender.Texture.Width * ImageRender.Scale.X / 2, ImageRender.Texture.Height * ImageRender.Scale.Y / 2); ImageRender.Scale = new Vector2(1, 1); AddComponent(ImageRender); Weapon = new Gun(this, "Weapon"); AddComponent(Weapon); _attackkey = new DoubleInput(this, "AttackKey", Keys.Enter, Buttons.A, PlayerIndex.One); _upkey = new DoubleInput(this, "UpKey", Keys.W, Buttons.DPadUp, PlayerIndex.One); _downkey = new DoubleInput(this, "DownKey", Keys.S, Buttons.DPadDown, PlayerIndex.One); _leftkey = new DoubleInput(this, "LeftKey", Keys.A, Buttons.DPadLeft, PlayerIndex.One); _rightkey = new DoubleInput(this, "RightKey", Keys.D, Buttons.DPadRight, PlayerIndex.One); _debugkey = new DoubleInput(this, "DebugKey", Keys.P, Buttons.Start, PlayerIndex.One); AddComponent(_attackkey); AddComponent(_upkey); AddComponent(_downkey); AddComponent(_leftkey); AddComponent(_rightkey); AddComponent(_debugkey); _moveanalog = new GamePadAnalog(this, "MoveAnalog", Sticks.Left, PlayerIndex.One); AddComponent(_moveanalog); _aimanalog = new GamePadAnalog(this, "AimAnalog", Sticks.Right, PlayerIndex.One); AddComponent(_aimanalog); _shoottrigger = new GamePadTrigger(this, "ShootTrigger", Triggers.Right, PlayerIndex.One); AddComponent(_shoottrigger); }
public Particle(EntityState stateref, IComponent parent, int index, Vector2 position, int ttl, Emitter e) : base(stateref, parent, e.Name + ".Particle") { Name = Name + Id; Body = new Body(this, "Body", position); AddComponent(Body); TileBaseRender = new TileRender(this, "TileRender", e.Texture, e.TileSize); TileBaseRender.Index = index; AddComponent(TileBaseRender); Physics = new Physics(this, "Physics"); AddComponent(Physics); Emitter = e; TimeToLive = ttl; MaxTimeToLive = TimeToLive; }