Пример #1
0
        public void UniqueMonsterMovements(Enemy enemy, int i)
        {
            if (enemy.firingDelay == 60)
            {
                return;
            }

            int q = (int)enemy.UpperLeft.X;
            int r = (int)enemy.UpperLeft.Y;

            if (((q == 1798) && (r == 494)) || (q == 71) && (r == 494))
            {
                if (i == 6)
                {
                    if ((enemy.firingDelay != 180) && (enemy.firingDelay != 15))
                    {
                        enemy.firingDelay     = 180;
                        enemy.firingTimer     = enemy.firingDelay;
                        enemy.firingDirection = 15;
                    }

                    if (enemy.firingTimer == 0)
                    {
                        enemyBulletSprite = new EnemyBullet();
                        enemyBulletSprite.SetTexture(enemyBulletTexture);
                        enemyBulletSprite.Origin    = enemyBulletSprite.GetCenter();
                        enemyBulletSprite.UpperLeft = new Vector2((enemy.UpperLeft.X + enemy.GetCenter().X) - (enemyBulletSprite.GetWidth() / 2), (enemy.UpperLeft.Y + enemy.GetCenter().Y) - (enemyBulletSprite.GetHeight() / 2));
                        enemyBulletSprite.SetSpeedAndDirection(enemy.firingSpeed, Sprite.CalculateDirectionAngle(new Vector2((playerSprite.UpperLeft.X + playerSprite.GetWidth()) - (enemyBulletSprite.UpperLeft.X + enemyBulletSprite.GetWidth()), (playerSprite.UpperLeft.Y + playerSprite.GetWidth() / 2) - (enemyBulletSprite.UpperLeft.Y + enemyBulletSprite.GetWidth() / 2))) + enemy.firingDirection);
                        enemyBulletSprite.RotationAngle = enemyBulletSprite.GetDirectionAngle() + 90;

                        enemyBullets.AddLast(enemyBulletSprite);

                        if (enemy.firingDelay != 15)
                        {
                            enemy.firingDelay = 15;
                        }

                        enemy.firingDirection -= 15;
                        enemy.firingTimer      = enemy.firingDelay;

                        if (enemy.firingDirection == -30)
                        {
                            enemy.firingDelay     = 60;
                            enemy.firingDirection = 270;
                            enemy.firingTimer     = enemy.firingDelay;
                        }
                    }
                }
            }
        }