示例#1
0
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            player.SightRange = 300;
            GameObjectVertical target = player.FindAimObject();

            if (target == null)
            {
                return(false);
            }

            Vector2 dir       = new Vector2(target.PositionX - player.PositionX, target.PositionY - player.PositionY);
            Vector2 scaledDir = MathFunctions.ScaleDirection(dir);

            TurretBullet bullet = new TurretBullet(Game, spriteSheet);

            bullet.PositionX = player.PositionX;
            bullet.PositionY = player.PositionY;
            BasicBulletSetup(bullet);
            bullet.Direction = scaledDir;
            bullet.Speed     = speed;
            bullet.Damage    = damage;

            Game.stateManager.shooterState.gameObjects.Add(bullet);
            return(true);
        }
示例#2
0
        private void Setup()
        {
            Name = "Turret";
            Kind = "Secondary";
            energyCostPerSecond = 0f;
            delay            = 600;
            Weight           = 130;
            ActivatedSoundID = SoundEffects.MidSizeLaser;
            displaySprite    = Game.spriteSheetItemDisplay.GetSubSprite(new Rectangle(0, 100, 100, 100));

            bullet = new TurretBullet(Game, spriteSheet);
            bullet.Initialize();

            damage   = Bullet.Damage;
            duration = Bullet.Duration;
            speed    = Bullet.Speed;

            Value         = 500;
            Tier          = TierType.Good;
            numberOfShots = 1;
        }