Beispiel #1
0
        public void Fire(UserControlledCharacter character, EngineGame world, GameTime gameTime, double holdTime, bool charged)
        {
            Character = character;
            if (timeSinceLastShot >= TIME_BETWEEN_SHOTS * Engine.LevelManager.PhysicsManager.GlobalReferenceScale && !reloading && ammo > 0)
            {
                timeSinceLastShot = 0;
                EnergyBullet bullet = new EnergyBullet(
                    new Vector2(character.Physics.Position.X,// + UserControlledCharacter.X_OFFSET,
                                character.Physics.Position.Y + Y_OFFSET),
                                20, 20,
                                PhysicsConstants.PixelsToMeters(BULLET_SPEED * character.Direction));

                ammo -= 1;

                if (ammo <= 0)
                {
                    Reload();
                }

                world.LevelManager.RegisterEntity(bullet);
            }
        }
Beispiel #2
0
 protected override bool OnCollidedWith(Fixture f, EnergyBullet bullet, Fixture df, Contact info)
 {
     bullet.Dead = true;
     Health -= 50;
     return true;
 }
Beispiel #3
0
 protected virtual bool OnCollidedWith(Fixture f, EnergyBullet bullet, Fixture df, Contact info)
 {
     health -= 7;
     return true;
 }