Ejemplo n.º 1
0
 public override void Update(GameTime gameTime)
 {
     if (WindowSize.IsOutOfBounds(Position))
     {
         Death();
     }
     base.Update(gameTime);
 }
Ejemplo n.º 2
0
 public override void Death()
 {
     //Particles.GenerateParticles(Position, 18, angle, sprite.MColor); //Death animation
     if (WindowSize.IsOutOfBounds(Position))
     {
         OutOfBoundsDeath();
     }
     else
     {
         base.Death();
     }
 }
Ejemplo n.º 3
0
 protected void UpdateTimer(GameTime gameTime)
 {
     if (IsActive)
     {
         hitMeBbyOneMoreTime.CountDown(gameTime);
         despawnTimer.CountDown(gameTime);
         if (despawnTimer.IsFinished || WindowSize.IsOutOfBounds(Position))
         {
             Death();
         }
     }
 }
Ejemplo n.º 4
0
        protected override void CalculateAngle()
        {
            switch (specialMove)
            {
            case PIRATOSBOSS:
            case PIRATOS:
                Vector2 distVect = Position - player.Position;

                if (distVect.Length() < pirateRand)
                {
                    distVect = Vector2.Transform(distVect, Matrix.CreateRotationZ((float)Math.PI / 2));
                    base.CalculateAngle(distVect.X, distVect.Y);
                    attackTimer.Reset();
                    Hull.Velocity /= 1.5f;     //SlowDOWN
                }
                else
                {
                    waitTimer.Reset();
                    base.CalculateAngle();
                }
                break;

            case BOSS3:
                if (waitTimer.IsFinished)
                {
                    Hull.Angle += 0.1f;
                }
                else
                {
                    Hull.Angle += 0.03f;
                }
                break;

            case SPREAD_OUT:
                int rnd = SRandom.Next(0, 500);
                if (rnd < 2 && !turning)
                {
                    turning      = true;
                    oldAngle     = Hull.Angle;
                    amountTurned = 0;
                }

                if (turning)
                {
                    float turnAmount = TurnSpeed;
                    Hull.Angle   += turnAmount;
                    Hull.Angle   %= (float)Math.PI * 2;
                    amountTurned += turnAmount;
                    float addedAngle = 0;
                    float dX         = Position.X - player.Position.X;
                    float dY         = Position.Y - player.Position.Y;
                    if (dX == 0)
                    {
                        dX = 0.00001f;
                    }
                    addedAngle  = (float)Math.Atan(dY / dX);
                    addedAngle %= (float)Math.PI * 2;
                    if (dX > 0)
                    {
                        addedAngle += (float)Math.PI;
                    }

                    if (amountTurned >= Math.PI && Math.Abs(Hull.Angle - addedAngle) < 0.2 || WindowSize.IsOutOfBounds(Position))
                    {
                        turning = false;
                    }
                }
                else
                {
                    base.CalculateAngle();
                }
                break;

            default:
                base.CalculateAngle();
                break;
            }
        }