Beispiel #1
0
        public override void SpecialUpdate()
        {
            if (team == 1 && justInfected)
            {
                rotation    += (float)Math.PI;
                justInfected = false;
            }
            counter++;
            Velocity = Functions.PolarVector(4, rotation);
            if (counter > preWingDeployTime + wingDeployTime)
            {
                Vector2 aimAt = new Vector2(0, 0);
                if (team == 1)
                {
                    if (Miasma.BossIsActive())
                    {
                        aimAt = Miasma.boss.Position;
                    }
                }
                else
                {
                    aimAt = Miasma.player.Position;
                }
                rotation = Functions.SlowRotation(rotation, Functions.ToRotation(aimAt - Position), (float)Math.PI / 240);
            }
            if (team == 1)
            {
                if (Miasma.random.Next(5) == 0)
                {
                    new Particle(Position, Functions.PolarVector((float)Miasma.random.NextDouble() * 2f, Functions.RandomRotation()), Miasma.random.Next(2), 15);
                }
            }
            bool explode = false;

            for (int i = 0; i < Miasma.gameEntities.Count; i++)
            {
                if (Miasma.gameEntities[i].maxHealth != -1 && Miasma.gameEntities[i].Hitbox.Intersects(Hitbox) && team != Miasma.gameEntities[i].team)
                {
                    explode = true;
                }
            }
            if (explode)
            {
                for (int i = 0; i < Miasma.gameEntities.Count; i++)
                {
                    if (Miasma.gameEntities[i].maxHealth != -1 && Miasma.gameEntities[i].Hitbox.Intersects(new Rectangle((int)Position.X - blastRadius, (int)Position.Y - blastRadius, blastRadius * 2, blastRadius * 2)) && team != Miasma.gameEntities[i].team)
                    {
                        Miasma.gameEntities[i].Strike(10);
                    }
                }
                health = 0;
            }
            if (Position.Y > 850)
            {
                health = 0;
            }
        }
Beispiel #2
0
 public override void SpecialUpdate()
 {
     speed = parent.speed * 1.3f;
     if (!Miasma.BossIsActive())
     {
         health = 0;
     }
     if (team == 1)
     {
         infectTime++;
     }
     if (infectTime > 60 || team == 0)
     {
         for (int i = 0; i < Miasma.gameEntities.Count; i++)
         {
             if (Miasma.gameEntities[i].maxHealth != -1 && Miasma.gameEntities[i].Hitbox.Intersects(Hitbox) && team != Miasma.gameEntities[i].team)
             {
                 if (!(parent.blocks.Contains(Miasma.gameEntities[i]) && team == 0))
                 {
                     Miasma.gameEntities[i].Strike(10);
                     health = 0;
                     break;
                 }
             }
         }
     }
     if (guarding)
     {
         rotation = 0;
         if ((moveTo - Position).Length() < speed)
         {
             Position = moveTo;
             Velocity = Vector2.Zero;
             rotation = 0f;
         }
         else
         {
             Velocity = Functions.PolarVector(speed, Functions.ToRotation(moveTo - Position));
         }
     }
     else
     {
         Velocity = Functions.PolarVector(Velocity.Length(), rotation + (float)Math.PI / 2);
         rotation = Functions.SlowRotation(rotation, 0, (float)Math.PI / 30);
         if (rotation == 0)
         {
             guarding = true;
         }
     }
     if (team == 1)
     {
         if (Miasma.random.Next(5) == 0)
         {
             new Particle(Position, Functions.PolarVector((float)Miasma.random.NextDouble() * 2f, Functions.RandomRotation()), Miasma.random.Next(2), 15);
         }
     }
 }
Beispiel #3
0
 public override void MainUpdate()
 {
     if (canDespawn)
     {
         NormalMovement();
         acting = -1;
         home.X = Position.X > 300 ? 600 : 0;
         if (Position.X < 20 || Position.X > 580)
         {
             health = 0;
         }
     }
     else if (!Miasma.BossIsActive())
     {
         home.X += (float)Math.Cos(trigCounter) * .2f;
     }
     if (team == 1)
     {
         InfectedUpdate();
         if (Miasma.random.Next(5) == 0)
         {
             new Particle(Position, Functions.PolarVector((float)Miasma.random.NextDouble() * 2f, Functions.RandomRotation()), Miasma.random.Next(2), 15);
         }
         foreach (Upgrade upgrade in Miasma.player.upgrades)
         {
             if (upgrade != null)
             {
                 upgrade.InfectedShipUpdate(this);
             }
         }
     }
     else
     {
         if (acting == 0)
         {
             ActionUpdate();
         }
         else
         {
             if (acting > 0)
             {
                 if (acting == 1)
                 {
                     ActionStart();
                 }
                 acting--;
             }
             NormalMovement();
         }
     }
 }
Beispiel #4
0
 public override void MainUpdate()
 {
     if (!Miasma.BossIsActive())
     {
         health = 0;
     }
     rotation += angularVelocity;
     for (int b = 0; b < beamTips.Length; b++)
     {
         beamTips[b] = Position + Functions.PolarVector(beamLength, rotation + b * (float)Math.PI / 2);
     }
     if (!launched)
     {
         Position = beholder.GetPosition() + Functions.PolarVector(10f, beholder.GetRotation());
         Velocity = Vector2.Zero;
     }
     else
     {
         if (beamLength < maxBeamLength)
         {
             beamLength += maxBeamLength / 50;
         }
         if (beamLength > 6)
         {
             Sounds.beamLighting.PlayContinuous();
             foreach (Vector2 tip in beamTips)
             {
                 if (Miasma.random.Next(10) == 0)
                 {
                     new Particle(tip, Vector2.Zero, 7, 30);
                 }
                 Vector2?collisionAt = null;
                 if (Functions.RectangleLineCollision(Miasma.player.Hitbox, Position, tip, ref collisionAt))
                 {
                     Miasma.player.Strike(10);
                     beamLength = 0;
                     for (int i = 0; i < 20; i++)
                     {
                         new Particle((Vector2)collisionAt, Functions.PolarVector((float)Miasma.random.NextDouble() * 4f, Functions.RandomRotation()), 7, 15);
                     }
                 }
             }
         }
     }
     if (Position.Y < -50)
     {
         health = 0;
     }
 }
Beispiel #5
0
        public override void InfectedUpdate()
        {
            Vector2 flyTo        = Miasma.player.Position + (Vector2.UnitY * -20f);
            float   goalRotation = (float)Math.PI;

            if (Miasma.BossIsActive() && Miasma.boss is Jupiter)
            {
                flyTo        = Miasma.player.Position + (Vector2.UnitY * 20f);
                goalRotation = 0f;
            }
            infectTimer++;
            if (health > 10)
            {
                Velocity = (flyTo - Position);
                if (Velocity.Length() > speed)
                {
                    ShieldOff();
                    Velocity.Normalize();
                    Velocity *= speed;
                    rotation  = Functions.ToRotation(Velocity) - (float)Math.PI / 2;
                }
                else
                {
                    ShieldOn();
                    rotation = Functions.SlowRotation(rotation, goalRotation, (float)Math.PI / 30);
                }
                if (infectTimer % 60 == 0)
                {
                    health--;
                }
                foreach (SpartanClaw claw in claws)
                {
                    claw.AimTowardSavedPosition(0);
                }
            }
            else
            {
                ShieldOff();
                Velocity = Vector2.Zero;
                rotation = Functions.SlowRotation(rotation, goalRotation, (float)Math.PI / 30);
                infectTimer2++;
                shootPattern(infectTimer2);
                if (infectTimer2 > preShootTime + postShootTime + 60)
                {
                    health = 0;
                }
            }
        }
Beispiel #6
0
 public override void MainUpdate()
 {
     if (!Miasma.BossIsActive())
     {
         health = 0;
     }
     if (activated)
     {
         Velocity = (goTo - Position);
         if (Velocity.Length() > speed)
         {
             Velocity.Normalize();
             Velocity  *= speed;
             chargeTime = 0;
         }
         else if (Velocity.Length() == 0)
         {
             chargeTime++;
             if (chargeTime < shotTime)
             {
                 for (int i = 0; i < 1; i++)
                 {
                     float r = Functions.RandomRotation() * -.5f;
                     new Particle(Position + Vector2.UnitY * -12f + Functions.PolarVector(15, r), Functions.PolarVector(-1, r), 7, 15);
                 }
             }
             else if (chargeTime == shotTime)
             {
                 new LightningBolt(Position + Vector2.UnitY * -12f, Vector2.UnitY * -10, 0, team);
             }
             else if (chargeTime > shotTime + 60)
             {
                 pickSpot();
             }
         }
     }
     else
     {
         Velocity = Vector2.Zero;
     }
     if (team == 1)
     {
         health = 0;
     }
 }