Example #1
0
        /// <summary>
        /// Returns an unitialised deep copy of the Emitter.
        /// </summary>
        /// <returns>A deep copy of the Emitter.</returns>
        public override Emitter DeepCopy()
        {
            Emitter copy = new ConeEmitter
            {
                ConeAngle = this.ConeAngle,
                Direction = this.Direction
            };

            base.CopyBaseFields(copy);

            return(copy);
        }
        /// <summary>
        /// Returns an unitialised deep copy of the Emitter.
        /// </summary>
        /// <returns>A deep copy of the Emitter.</returns>
        public override Emitter DeepCopy()
        {
            Emitter copy = new ConeEmitter
            {
                ConeAngle = this.ConeAngle,
                Direction = this.Direction
            };

            base.CopyBaseFields(copy);

            return copy;
        }
Example #3
0
        public PlayerShip(Game game, Vector2 position)
        {
            Game = game;
            _soundBank = Game.Services.GetService<SoundBank[]>();
            _world = Game.Services.GetService<World>();
            krypton = Game.Services.GetService<KryptonEngine>();

            thrustLR = _soundBank[0].GetCue("thrust01");
            thrustLR.Play();
            thrustLR.Pause();

            thrustUD = _soundBank[0].GetCue("thrust01");
            thrustUD.Play();
            thrustUD.Pause();

            Position = position;
            _particleRenderer = Game.Services.GetService<SpriteBatchRenderer>();
            //_textures = Game.Services.GetService<Textures>();

            //Loadcontentstuff
            _shiptxture = Game.Content.Load<Texture2D>("player_ship");
            _turretTxture = Game.Content.Load<Texture2D>(".\\guns\\turret01");
            _centreVect = new Vector2(_shiptxture.Width / 2, _shiptxture.Height / 2);

            ProximityBox = new Rectangle(0, 0, _shiptxture.Width+Globals.PhysBuffer, _shiptxture.Height + Globals.PhysBuffer);

            //make ship fixture in for farseer
            box = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(_shiptxture.Width / 2), 7.0f);
            box.BodyType = BodyType.Dynamic;
            box.Restitution = 0.5f;
            box.Friction = 0.2f;
            box.FixedRotation = true;
            box.LinearDamping = 0.4f;
            box.Position = ConvertUnits.ToSimUnits(Position.X + _centreVect.X, Position.Y + _centreVect.Y);
            box.UserData = "player";

            //box.OnCollision += Collide;
            box.OnSeparation += Collide;

            //make light in krypton
            var mLightTexture = LightTextureBuilder.CreateConicLight(Game.GraphicsDevice, 256, 2.0f);
            light = CreateLights(mLightTexture,400);
            var mLightTexture2 = LightTextureBuilder.CreatePointLight(Game.GraphicsDevice, 64);
            light2 = CreateLights(mLightTexture2,200);

            //set up thruster particle
            _thrustparticle = Game.Content.Load<ParticleEffect>(".\\mercury\\thruster");
            _thrustparticle.LoadContent(Game.Content);
            _thrusterEmitter = (ConeEmitter)_thrustparticle[0];
            //_thrusterEmitter.Initialise();
            _thrusterEmitter.ParticleTexture = Game.Content.Load<Texture2D>(".\\mercury\\Particle004");
            _thrustparticle.Initialise();
            _particleRenderer.LoadContent(Game.Content);

            //_centerVect = new Vector2(_shiptxture.Width / 2,_shiptxture.Width / 2);
            currentWeapon = new Gun(Game, true, BulletsStats.Plasma01);
        }
Example #4
0
        protected override void LoadContent()
        {
            base.LoadContent();

            _texture = Game.Content.Load<Texture2D>("Ship");
            _origin = new Vector2(_texture.Width / 2, _texture.Height / 2);
            _thrusterAttachmentPoint = new Vector2(-_texture.Width / 2 + 4, -3);

            /* Todo_:
             * Load the particle effect called "Thruster" and assign it to the _thruster field.
             * Call the InitializeEmitters method to initialize the emitters and particle textures.
             * Finally Do the same for the particle effect called "Explosion".
             *  You ll need to create your own explosion particleEffect with a tool (inside tools) in the  code you downloaded
             *
            */

            // Hint:
            // You can get access to the content manager through the Game.Content property.

            if(_thruster != null)
                _thrusterEmitter = (ConeEmitter) _thruster[0];
        }
Example #5
0
        protected override void LoadContent()
        {
            base.LoadContent();

            _texture = Game.Content.Load<Texture2D>("Ship");
            _origin = new Vector2(_texture.Width / 2, _texture.Height / 2);
            _thrusterAttachmentPoint = new Vector2(-_texture.Width / 2 + 4, -3);

            // Todo:
            // Load the particle effect called "Thruster" and assign it to the _thruster field. Call the InitializeEmitters
            //  method to initialize the emitters and particle textures. Do the same for the particle effect called "Explosion".
            _thruster = Game.Content.Load<ParticleEffect>("Thruster");
            _explosion = Game.Content.Load<ParticleEffect>("explosion");
            InitializeEmitters(_thruster);
            InitializeEmitters(_explosion);

            // Hint:
            // You can get access to the content manager through the Game.Content property.

            if(_thruster != null)
                _thrusterEmitter = (ConeEmitter) _thruster[0];
        }