Exemplo n.º 1
0
        public override void Update()
        {
            base.Update();

            if (destroyed)
            {
                Globals.currentState = State.StartMenu;
            }

            missileShootCooldown.UpdateTimer();
            shootTimer.UpdateTimer();

            UpdateShield();

            MoveJet();
            Rotate();


            if (Globals.mouse.LeftClick() && shootTimer.Test())
            {
                ShootRegularBullet();
                shootTimer.Reset(1000 - bulletFireSpeed);
            }
            if (Globals.mouse.RightClick() && missileShootCooldown.Test())
            {
                ShootMissile();
                missileShootCooldown.Reset(10000 - missileFireSpeed);
            }
        }
        public override void BehaveArtificially()
        {
            shootTimer.UpdateTimer();
            moveTimer.UpdateTimer();

            if (position.Y < Globals.screenHeight / 4)
            {
                position += Physics.RadialMovement(GameGlobals.playerJet.position, position, speed);
            }

            if (moveTimer.Test())
            {
                movesLeft  = !movesLeft;
                movesRight = !movesRight;
                int time;
                if (movesRight)
                {
                    time = (int)(right / speed) * 14;
                }
                else
                {
                    time = (int)(left / speed) * 14;
                }
                moveTimer.Reset(time);
            }

            if (movesLeft)
            {
                position.X -= speed;
            }
            if (movesRight)
            {
                position.X += speed;
            }

            if (!GameGlobals.playerJet.destroyed)
            {
                Rotate();
                Shoot();
            }
        }