public Ship(Texture2D shiptexture, Texture2D bullettexture, EntityState es) : base(es) { Body = new Body(this, new Vector2(es.GameRef.Viewport.Width / 2.0f, es.GameRef.Viewport.Height / 2.0f), new Vector2(shiptexture.Width, shiptexture.Height)); Components.Add(Body); Physics = new Physics(this) { Drag = 0.9f }; Components.Add(Physics); Render = new Render(this, shiptexture) { Scale = .5f }; Components.Add(Render); Weapon = new Gun(this, bullettexture); Components.Add(Weapon); Health = new Health(this, 5); Health.DiedEvent += Destroy; Health.DiedEvent += EmitEventHandler; Components.Add(Health); Collision = new Collision(this); Components.Add(Collision); ThrustEmitter = new ThrustEmitter(this, StateRef.GameRef.Game.Content.Load <Texture2D>(@"particles/thrustparticle")); Components.Add(ThrustEmitter); DeathEmitter = new DeathEmitter(this, StateRef.GameRef.Game.Content.Load <Texture2D>(@"particles/shipdeathparticle123")); Components.Add(DeathEmitter); _attackkey = new KeyboardInput(Keys.Enter); _upkey = new KeyboardInput(Keys.W); _downkey = new KeyboardInput(Keys.S); _leftkey = new KeyboardInput(Keys.A); _rightkey = new KeyboardInput(Keys.D); _debugkey = new KeyboardInput(Keys.L); }
public Ship(Texture2D shiptexture, Texture2D bullettexture, EntityState es) : base(es) { Body = new Body(this, new Vector2(es.GameRef.Viewport.Width / 2.0f, es.GameRef.Viewport.Height / 2.0f), new Vector2(shiptexture.Width, shiptexture.Height)); Components.Add(Body); Physics = new Physics(this) { Drag = 0.9f }; Components.Add(Physics); Render = new Render(this, shiptexture) { Scale = .5f }; Components.Add(Render); Weapon = new Gun(this, bullettexture); Components.Add(Weapon); Health = new Health(this, 5); Health.DiedEvent += Destroy; Health.DiedEvent += EmitEventHandler; Components.Add(Health); Collision = new Collision(this); Components.Add(Collision); ThrustEmitter = new ThrustEmitter(this, StateRef.GameRef.Game.Content.Load<Texture2D>(@"particles/thrustparticle")); Components.Add(ThrustEmitter); DeathEmitter = new DeathEmitter(this, StateRef.GameRef.Game.Content.Load<Texture2D>(@"particles/shipdeathparticle123")); Components.Add(DeathEmitter); _attackkey = new KeyboardInput(Keys.Enter); _upkey = new KeyboardInput(Keys.W); _downkey = new KeyboardInput(Keys.S); _leftkey = new KeyboardInput(Keys.A); _rightkey = new KeyboardInput(Keys.D); _debugkey = new KeyboardInput(Keys.L); }
public void EmitEventHandler(Entity e = null) { DeathEmitter.Emit(100); }