Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public void EmitEventHandler(Entity e = null)
 {
     DeathEmitter.Emit(100);
 }