예제 #1
0
        //System.Windows.Media.DrawingVisual
        /*
        public static System.Windows.Media.DrawingVisual Render()
        {
            System.Windows.Media.DrawingVisual drawingVisual = new System.Windows.Media.DrawingVisual();

            // Retrieve the DrawingContext in order to create new drawing content.
            System.Windows.Media.DrawingContext drawingContext = drawingVisual.RenderOpen();

            System.Windows.Media.Pen MyPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Black, 1);

            // Create a rectangle and draw it in the DrawingContext.
            foreach (Projectile P in Projectiles)
            {
                Rect rect = new Rect(new System.Windows.Point(P.XPos - 1, P.YPos - 1), new System.Windows.Size(2, 2));
                drawingContext.DrawRectangle(System.Windows.Media.Brushes.Black, (System.Windows.Media.Pen)null, rect);
                //drawingContext.DrawLine(MyPen, new Point(P.XPos, P.YPos), new Point(P.XPos + P.XVel, P.YPos + P.YVel));

            }
            // Persist the drawing content.
            drawingContext.Close();

            return drawingVisual;
        }
         * */
        
        //System.Windows.Media.Pen MyPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Black, 1);
        //static Rect rect = new Rect(new Point(0, 0), new Size(2, 2));

        //public static void OnRender(System.Windows.Media.DrawingContext drawingContext)
        //{
            //foreach (Projectile P in Projectiles)
            //{
                //  rect.Location = new Point(P.XPos - 1, P.YPos - 1);
                //  drawingContext.DrawRectangle(System.Windows.Media.Brushes.Black, null, rect);//(System.Windows.Media.Pen)



                //   int T = Arena.instance.Frame - P.AquiredFrame;
                //   Point O = new Point((P.XPos + (P.XVel * T)) - 1, (P.YPos+(P.YVel*T) - 1));

                //   rect = new Rect(O, new System.Windows.Size(2, 2));
                //   drawingContext.DrawRectangle(System.Windows.Media.Brushes.Black, (System.Windows.Media.Pen)null, rect);



                //rect = new Rect(new System.Windows.Point((P.XPos - P.XVel / 10) - 1, (P.YPos - P.YVel / 10) - 1), new System.Windows.Size(2, 2));
                //drawingContext.DrawRectangle(System.Windows.Media.Brushes.Gray, (System.Windows.Media.Pen)null, rect);

                //rect = new Rect(new System.Windows.Point((P.XPos - P.XVel / 5) - 1, (P.YPos - P.YVel / 5) - 1), new System.Windows.Size(2, 2));
                //drawingContext.DrawRectangle(System.Windows.Media.Brushes.Gray, (System.Windows.Media.Pen)null, rect);

                //rect = new Rect(new System.Windows., new System.Windows.Size(2, 2));

              

                //drawingContext.DrawLine(MyPen, new Point(P.XPos, P.YPos), new Point(P.XPos + P.XVel, P.YPos + P.YVel));
            //}
        //}

        static public void GenericHitCreep(Creep C)
        {
            C.TakeDamage(10);
        }
예제 #2
0
 /// <summary>
 /// Called when a creep is killed
 /// </summary>
 static public void Die(Creep C)
 {
     lock (C)
     {
         if (C.IsAlive == true)
         {
             C.IsAlive = false;
             Arena.instance.BankBalance += C.Bounty;
             C.Bounty = 0;
             C.Health = -1;
             C.Track = null;
             Released.Enqueue(C);
         }
     }
 }
예제 #3
0
        public new void Tick(int FrameCount)
        {
            base.Tick(FrameCount);

            if (this.SubClassData == null)
            {
                if (this.Data == null)
                {
                    return;
                }
                SubClassData = Data as ProjectileTowerData;
            }

            if (ProjectileColor == Colors.Transparent)
            {
                ProjectileColor = System.Windows.Media.Color.FromRgb((byte)R.Next(255), (byte)R.Next(255), (byte)R.Next(255));
               // Arena.instance.AddToArena(TargetLaserD);
                //Arena.instance.AddToArena(TargetLaserB);
            }



            if (RefireCount > 0)
            {
                RefireCount--;
            }
            

            CurrentTarget = null;
            double TXV;
            double TYV;
            double V;

            //System.Windows.Media.Color bc = Color.FromScRgb(1f, (float)(Heat / Data.ShutdownHeat), 0f, 0f);//(float)(Target.LockDuration / 255)
            //Body.Fill = new System.Windows.Media.SolidColorBrush(HeatColor(Heat, Data.ShutdownHeat));
            Body.Fill = StaticHelpers.HeatBrush(Heat, Data.ShutdownHeat);

            // Are we already locked on?
            if (Target.LockedTarget != null && Target.LockedTarget.IsAlive == true)
            {

                // is the locked target still in range?
                TXV = (Target.LockedTarget.XPos - PivotPoint.X);
                TYV = (Target.LockedTarget.YPos - PivotPoint.Y);
                V = (TXV) * (TXV) + (TYV) * (TYV);
                if (V < (SubClassData.Range * SubClassData.Range))
                {
                    CurrentTarget = Target.LockedTarget;
                    Target.LockDuration++;
                }
            }

            // Find a new target
            if (CurrentTarget == null)
            {
                CurrentTarget = NearestCreep(SubClassData.Range);
                Target.LockedTarget = CurrentTarget;
                Target.LockDuration = 0;
                return;
            }

            // No valid targets
            if (CurrentTarget == null)
            {
               // Body.Fill = Brushes.Blue;
                return;
            }

            Point TargetPoint = new Point(CurrentTarget.XPos, CurrentTarget.YPos);

            //lastsetrotation = new CoercedAngle(StaticHelpers.Angle(PivotPoint, TargetPoint));

            
            if (Target.LockDuration > 0)
            {
                float MuzzleVelocity = 25;

           //     TargetLaserB.X1 = this.PivotPoint.X;
           //     TargetLaserB.Y1 = this.PivotPoint.Y;
            //    TargetLaserB.X2 = CurrentTarget.XPos;
            //    TargetLaserB.Y2 = CurrentTarget.YPos;
            //    TargetLaserB.Stroke = Brushes.Green;
            //    TargetLaserB.StrokeThickness = 1;

                
                

                //calculate the distance to the target
                TXV = (CurrentTarget.XPos - PivotPoint.X);
                TYV = (CurrentTarget.YPos - PivotPoint.Y);
                V = Math.Sqrt((TXV) * (TXV) + (TYV) * (TYV));

                //calculate the targets velocity
                double VelocityX = TXV - Target.LockedTargetPriorX;
                double VelocityY = TYV - Target.LockedTargetPriorY;

                //save the current position to calc velocity next frame
                Target.LockedTargetPriorX = TXV;
                Target.LockedTargetPriorY = TYV;

                
                // calculate where the target will be in the time it takes the projectile to travel to it's current location.
                double ExPosX = CurrentTarget.XPos + (VelocityX * V / MuzzleVelocity);
                double ExPosY = CurrentTarget.YPos + (VelocityY * V / MuzzleVelocity);

                TargetPoint = new Point(ExPosX, ExPosY);

           //     TargetLaserA.X1 = this.PivotPoint.X;
           //     TargetLaserA.Y1 = this.PivotPoint.Y;
          //      TargetLaserA.X2 = ExPosX;
          //      TargetLaserA.Y2 = ExPosY;
          //      TargetLaserA.Stroke = Brushes.Red;
         //       TargetLaserA.StrokeThickness = 1;
                //Arena.instance.AddToArena(TargetLaserA);


                //calculate the distance to the new position.
                TXV = (ExPosX - PivotPoint.X);
                TYV = (ExPosY - PivotPoint.Y);
                V = Math.Sqrt((TXV) * (TXV) + (TYV) * (TYV));

                // re-calculate where the target will be in the time it takes the projectile to travel to it's current location.
                ExPosX = CurrentTarget.XPos + (VelocityX * V / MuzzleVelocity);
                ExPosY = CurrentTarget.YPos + (VelocityY * V / MuzzleVelocity);

         //       TargetLaserC.X1 = this.PivotPoint.X;
         //       TargetLaserC.Y1 = this.PivotPoint.Y;
         //       TargetLaserC.X2 = ExPosX;
         //       TargetLaserC.Y2 = ExPosY;
         //       TargetLaserC.Stroke = Brushes.Blue;
         //       TargetLaserC.StrokeThickness = 1;
                //Arena.instance.AddToArena(TargetLaserC);

                //calculate the distance to the new position.
                TXV = (ExPosX - PivotPoint.X);
                TYV = (ExPosY - PivotPoint.Y);
                V = Math.Sqrt((TXV) * (TXV) + (TYV) * (TYV));

                // re-re-calculate where the target will be in the time it takes the projectile to travel to it's current location.
                ExPosX = CurrentTarget.XPos + (VelocityX * V / MuzzleVelocity);
                ExPosY = CurrentTarget.YPos + (VelocityY * V / MuzzleVelocity);

        //        TargetLaserD.X1 = this.PivotPoint.X;
        //        TargetLaserD.Y1 = this.PivotPoint.Y;
        //        TargetLaserD.X2 = ExPosX;
        //        TargetLaserD.Y2 = ExPosY;
       //         TargetLaserD.Stroke = Brushes.White;
       //         TargetLaserD.StrokeThickness = 1;

          //      DoubleCollection dc = new DoubleCollection();
           //     dc.Add(1);
          //      dc.Add(4);

          //      TargetLaserD.StrokeDashArray = dc;

                

                TargetPoint = new Point(ExPosX, ExPosY);


                // Rotate barrel if not aligned with leading point.
                if (!IsAlignedTo(TargetPoint, SubClassData.TrackingSpeed))
                {
                    CoercedAngle diff = new CoercedAngle(StaticHelpers.Angle(PivotPoint, TargetPoint) - currentrotation.Angle);
                    if (diff.Angle > 180)
                    {
                        currentrotation.Angle -= SubClassData.TrackingSpeed;
                    }
                    else
                    {
                        currentrotation.Angle += SubClassData.TrackingSpeed;
                    }
                  //  Body.Fill = Brushes.Yellow;
                    Barrel.RenderTransform = new RotateTransform(currentrotation.Angle);
                    //return;

                }
                else
                {
                    // We are aligned (within tracking speed margin of error) with the targets predicted position.
                    currentrotation.Angle = StaticHelpers.Angle(PivotPoint, TargetPoint);
                    this.Barrel.RenderTransform = new RotateTransform(StaticHelpers.Angle(PivotPoint, TargetPoint));

                    //Are we ready to fire?
                    if (RefireCount <= 0 && Target.LockDuration > 1 && this.Heat <= this.Data.ShutdownHeat)
                    {
                        //FIRE!!!
                        Projectile P = Projectile.Create(
                            FrameCount,
                            (float)PivotPoint.X,
                            (float)PivotPoint.Y,
                            (float)(TXV / V) * (float)MuzzleVelocity,
                            (float)(TYV / V) * (float)MuzzleVelocity,
                            Projectile.GenericHitCreep
                            );
                        RefireCount = SubClassData.RefireDelay;
                        this.Heat += this.SubClassData.FiringHeat;
                    }
                }
            }
            
        }
예제 #4
0
        //Creep C = Creep.Spawn(Health, Bounty, Progress, Speed);
        static public Creep Spawn(double health, double bounty, double progress, double speed)
        {
            Creep C = new Creep(health);
            lock (C.CurrentCell.CreepsInCell)
            {
                C.CurrentCell.CreepsInCell.Add(C);
            }
            C.Bounty = bounty;
            C.Progress = progress;
            C.Speed = speed;
            Creeps.Add(C);
            C.IsAlive = true;
            return C;

            //C.Health = ;
            //Arena.instance.BankBalance += Bounty;
            //Arena.instance.AddToArena(C);
            //C.Track = null;
        }
예제 #5
0
        public new void Tick(int FrameCount)
        {
            base.Tick(FrameCount);

            if (this.SubClassData == null)
            {
                if (this.Data == null)
                {
                    return;
                }
                SubClassData = Data as BeamTowerData;
                
            }

            //if (ProjectileColor == Colors.Transparent)
            {
               // ProjectileColor = System.Windows.Media.Color.FromRgb((byte)R.Next(255), (byte)R.Next(255), (byte)R.Next(255));
               // Arena.instance.AddToArena(TargetLaserD);
                //Arena.instance.AddToArena(TargetLaserB);
            }

            CurrentTarget = null;
            double TXV;
            double TYV;
            double V;

            //System.Windows.Media.Color bc = Color.FromScRgb(1f, (float)(Heat / Data.ShutdownHeat), 0f, 0f);//(float)(Target.LockDuration / 255)
            //Body.Fill = new System.Windows.Media.SolidColorBrush(HeatColor(Heat, Data.ShutdownHeat));
            Body.Fill = StaticHelpers.HeatBrush(Heat, Data.ShutdownHeat);

            // Are we already locked on?
            if (Target.LockedTarget != null && Target.LockedTarget.IsAlive == true)
            {

                // is the locked target still in range?
                TXV = (Target.LockedTarget.XPos - PivotPoint.X);
                TYV = (Target.LockedTarget.YPos - PivotPoint.Y);
                V = (TXV) * (TXV) + (TYV) * (TYV);
                if (V < (SubClassData.Range * SubClassData.Range))
                {
                    CurrentTarget = Target.LockedTarget;
                    Target.LockDuration++;
                }
            }
            else
            {
                Arena.instance.Children.Remove(Beam);
                Beam.Stroke = Brushes.Transparent;
                Arena.instance.AddToArena(Beam);
            }

            // Find a new target
            if (CurrentTarget == null)
            {
                CurrentTarget = NearestCreep(SubClassData.Range);
                Target.LockedTarget = CurrentTarget;
                Target.LockDuration = 0;
                return;
            }

            // No valid targets
            if (CurrentTarget == null)
            {
                
                return;
            }

            if (RefireCount > 0)
            {
                RefireCount--;
            }
            
            Point TargetPoint = new Point(CurrentTarget.XPos, CurrentTarget.YPos);

            //lastsetrotation = new CoercedAngle(StaticHelpers.Angle(PivotPoint, TargetPoint));


            if (Target.LockDuration > 0)
            {
                // float MuzzleVelocity = 25;

                Beam.X1 = this.PivotPoint.X;
                Beam.Y1 = this.PivotPoint.Y;
                Beam.X2 = CurrentTarget.XPos;
                Beam.Y2 = CurrentTarget.YPos;
                // Beam.Stroke = Brushes.Green;
                Beam.StrokeThickness = 3;




                //calculate the distance to the target
                TXV = (CurrentTarget.XPos - PivotPoint.X);
                TYV = (CurrentTarget.YPos - PivotPoint.Y);
                V = Math.Sqrt((TXV) * (TXV) + (TYV) * (TYV));



                // Rotate barrel if not aligned with leading point.
                if (!IsAlignedTo(TargetPoint, SubClassData.TrackingSpeed))
                {
                    CoercedAngle diff = new CoercedAngle(StaticHelpers.Angle(PivotPoint, TargetPoint) - currentrotation.Angle);
                    if (diff.Angle > 180)
                    {
                        currentrotation.Angle -= SubClassData.TrackingSpeed;
                    }
                    else
                    {
                        currentrotation.Angle += SubClassData.TrackingSpeed;
                    }
                    //  Body.Fill = Brushes.Yellow;
                    Barrel.RenderTransform = new RotateTransform(currentrotation.Angle);
                    //return;

                }
                else
                {
                    // We are aligned (within tracking speed margin of error) with the targets predicted position.
                    currentrotation.Angle = StaticHelpers.Angle(PivotPoint, TargetPoint);
                    this.Barrel.RenderTransform = new RotateTransform(StaticHelpers.Angle(PivotPoint, TargetPoint));

                    //Are we ready to fire?

                    if (this.Heat > this.Data.ShutdownHeat)
                    {
                        RefireCount += 5;
                    }

                    if (RefireCount <= 0 && Target.LockDuration > 1 && this.Heat <= this.Data.ShutdownHeat)
                    {
                        //FIRE!!!
                        /*
                         * Projectile P = Projectile.Create(
                            FrameCount,
                            (float)PivotPoint.X,
                            (float)PivotPoint.Y,
                            (float)(TXV / V) * (float)MuzzleVelocity,
                            (float)(TYV / V) * (float)MuzzleVelocity,
                            Projectile.GenericHitCreep
                            );
                        RefireCount = SubClassData.RefireDelay;
                         */
                        Beam.Stroke = StaticHelpers.HeatBrush((float)Target.LockDuration + 50, 100f);
                        CurrentTarget.TakeDamage(Target.LockDuration / 20);
                        this.Heat += this.SubClassData.FiringHeat;
                    }
                    else
                    {
                        Beam.Stroke = Brushes.Transparent;
                    }
                }
            }
            else
            {
                Beam.Stroke = Brushes.Transparent;
            }
            
        }
예제 #6
0
        //System.Windows.Media.DrawingVisual

        /*
         * public static System.Windows.Media.DrawingVisual Render()
         * {
         *  System.Windows.Media.DrawingVisual drawingVisual = new System.Windows.Media.DrawingVisual();
         *
         *  // Retrieve the DrawingContext in order to create new drawing content.
         *  System.Windows.Media.DrawingContext drawingContext = drawingVisual.RenderOpen();
         *
         *  System.Windows.Media.Pen MyPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Black, 1);
         *
         *  // Create a rectangle and draw it in the DrawingContext.
         *  foreach (Projectile P in Projectiles)
         *  {
         *      Rect rect = new Rect(new System.Windows.Point(P.XPos - 1, P.YPos - 1), new System.Windows.Size(2, 2));
         *      drawingContext.DrawRectangle(System.Windows.Media.Brushes.Black, (System.Windows.Media.Pen)null, rect);
         *      //drawingContext.DrawLine(MyPen, new Point(P.XPos, P.YPos), new Point(P.XPos + P.XVel, P.YPos + P.YVel));
         *
         *  }
         *  // Persist the drawing content.
         *  drawingContext.Close();
         *
         *  return drawingVisual;
         * }
         * */

        //System.Windows.Media.Pen MyPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Black, 1);
        //static Rect rect = new Rect(new Point(0, 0), new Size(2, 2));

        //public static void OnRender(System.Windows.Media.DrawingContext drawingContext)
        //{
        //foreach (Projectile P in Projectiles)
        //{
        //  rect.Location = new Point(P.XPos - 1, P.YPos - 1);
        //  drawingContext.DrawRectangle(System.Windows.Media.Brushes.Black, null, rect);//(System.Windows.Media.Pen)



        //   int T = Arena.instance.Frame - P.AquiredFrame;
        //   Point O = new Point((P.XPos + (P.XVel * T)) - 1, (P.YPos+(P.YVel*T) - 1));

        //   rect = new Rect(O, new System.Windows.Size(2, 2));
        //   drawingContext.DrawRectangle(System.Windows.Media.Brushes.Black, (System.Windows.Media.Pen)null, rect);



        //rect = new Rect(new System.Windows.Point((P.XPos - P.XVel / 10) - 1, (P.YPos - P.YVel / 10) - 1), new System.Windows.Size(2, 2));
        //drawingContext.DrawRectangle(System.Windows.Media.Brushes.Gray, (System.Windows.Media.Pen)null, rect);

        //rect = new Rect(new System.Windows.Point((P.XPos - P.XVel / 5) - 1, (P.YPos - P.YVel / 5) - 1), new System.Windows.Size(2, 2));
        //drawingContext.DrawRectangle(System.Windows.Media.Brushes.Gray, (System.Windows.Media.Pen)null, rect);

        //rect = new Rect(new System.Windows., new System.Windows.Size(2, 2));



        //drawingContext.DrawLine(MyPen, new Point(P.XPos, P.YPos), new Point(P.XPos + P.XVel, P.YPos + P.YVel));
        //}
        //}

        static public void GenericHitCreep(Creep C)
        {
            C.TakeDamage(10);
        }
예제 #7
0
        public new void Tick(int FrameCount)
        {
            base.Tick(FrameCount);

            if (this.SubClassData == null)
            {
                if (this.Data == null)
                {
                    return;
                }
                SubClassData = Data as BeamTowerData;
            }

            //if (ProjectileColor == Colors.Transparent)
            {
                // ProjectileColor = System.Windows.Media.Color.FromRgb((byte)R.Next(255), (byte)R.Next(255), (byte)R.Next(255));
                // Arena.instance.AddToArena(TargetLaserD);
                //Arena.instance.AddToArena(TargetLaserB);
            }

            CurrentTarget = null;
            double TXV;
            double TYV;
            double V;

            //System.Windows.Media.Color bc = Color.FromScRgb(1f, (float)(Heat / Data.ShutdownHeat), 0f, 0f);//(float)(Target.LockDuration / 255)
            //Body.Fill = new System.Windows.Media.SolidColorBrush(HeatColor(Heat, Data.ShutdownHeat));
            Body.Fill = StaticHelpers.HeatBrush(Heat, Data.ShutdownHeat);

            // Are we already locked on?
            if (Target.LockedTarget != null && Target.LockedTarget.IsAlive == true)
            {
                // is the locked target still in range?
                TXV = (Target.LockedTarget.XPos - PivotPoint.X);
                TYV = (Target.LockedTarget.YPos - PivotPoint.Y);
                V   = (TXV)*(TXV) + (TYV)*(TYV);
                if (V < (SubClassData.Range * SubClassData.Range))
                {
                    CurrentTarget = Target.LockedTarget;
                    Target.LockDuration++;
                }
            }
            else
            {
                Arena.instance.Children.Remove(Beam);
                Beam.Stroke = Brushes.Transparent;
                Arena.instance.AddToArena(Beam);
            }

            // Find a new target
            if (CurrentTarget == null)
            {
                CurrentTarget       = NearestCreep(SubClassData.Range);
                Target.LockedTarget = CurrentTarget;
                Target.LockDuration = 0;
                return;
            }

            // No valid targets
            if (CurrentTarget == null)
            {
                return;
            }

            if (RefireCount > 0)
            {
                RefireCount--;
            }

            Point TargetPoint = new Point(CurrentTarget.XPos, CurrentTarget.YPos);

            //lastsetrotation = new CoercedAngle(StaticHelpers.Angle(PivotPoint, TargetPoint));


            if (Target.LockDuration > 0)
            {
                // float MuzzleVelocity = 25;

                Beam.X1 = this.PivotPoint.X;
                Beam.Y1 = this.PivotPoint.Y;
                Beam.X2 = CurrentTarget.XPos;
                Beam.Y2 = CurrentTarget.YPos;
                // Beam.Stroke = Brushes.Green;
                Beam.StrokeThickness = 3;



                //calculate the distance to the target
                TXV = (CurrentTarget.XPos - PivotPoint.X);
                TYV = (CurrentTarget.YPos - PivotPoint.Y);
                V   = Math.Sqrt((TXV)*(TXV) + (TYV)*(TYV));



                // Rotate barrel if not aligned with leading point.
                if (!IsAlignedTo(TargetPoint, SubClassData.TrackingSpeed))
                {
                    CoercedAngle diff = new CoercedAngle(StaticHelpers.Angle(PivotPoint, TargetPoint) - currentrotation.Angle);
                    if (diff.Angle > 180)
                    {
                        currentrotation.Angle -= SubClassData.TrackingSpeed;
                    }
                    else
                    {
                        currentrotation.Angle += SubClassData.TrackingSpeed;
                    }
                    //  Body.Fill = Brushes.Yellow;
                    Barrel.RenderTransform = new RotateTransform(currentrotation.Angle);
                    //return;
                }
                else
                {
                    // We are aligned (within tracking speed margin of error) with the targets predicted position.
                    currentrotation.Angle       = StaticHelpers.Angle(PivotPoint, TargetPoint);
                    this.Barrel.RenderTransform = new RotateTransform(StaticHelpers.Angle(PivotPoint, TargetPoint));

                    //Are we ready to fire?

                    if (this.Heat > this.Data.ShutdownHeat)
                    {
                        RefireCount += 5;
                    }

                    if (RefireCount <= 0 && Target.LockDuration > 1 && this.Heat <= this.Data.ShutdownHeat)
                    {
                        //FIRE!!!

                        /*
                         * Projectile P = Projectile.Create(
                         *  FrameCount,
                         *  (float)PivotPoint.X,
                         *  (float)PivotPoint.Y,
                         *  (float)(TXV / V) * (float)MuzzleVelocity,
                         *  (float)(TYV / V) * (float)MuzzleVelocity,
                         *  Projectile.GenericHitCreep
                         *  );
                         * RefireCount = SubClassData.RefireDelay;
                         */
                        Beam.Stroke = StaticHelpers.HeatBrush((float)Target.LockDuration + 50, 100f);
                        CurrentTarget.TakeDamage(Target.LockDuration / 20);
                        this.Heat += this.SubClassData.FiringHeat;
                    }
                    else
                    {
                        Beam.Stroke = Brushes.Transparent;
                    }
                }
            }
            else
            {
                Beam.Stroke = Brushes.Transparent;
            }
        }
        public void SpawnWave()
        {
            double xc = CreepWaveSize;

            this.CreepWaveFactor *= 1.1;

            if (CreepWaveFactor > CreepWaveSize)
            {
                CreepWaveFactor = 1;
                CreepInterval  *= .8;
                if (CreepInterval < 50)
                {
                    CreepInterval  = 1000;
                    CreepWaveSize *= 2;
                }
            }

            while (xc-- > 0)
            {
                //TransformGroup TG = new TransformGroup();

                double Progress = -(xc / 2);
                double Speed    = 5 / CreepWaveFactor;
                double Health   = 100 * CreepWaveFactor;
                double Bounty   = 10;

//                C.Health = 5 * CreepWaveFactor;
//              C.MaxHealth = 5 * CreepWaveFactor;

                //C.MaxHealth = 100 * CreepWaveFactor;

                //C.Speed = 1;

                //double up if too many creeps already on screen.
                //Arena.instance.Creeps.TrimToSize();
                if (xc >= 1 && Creep.Creeps.Count > 10)
                {
                    Health *= 2;
                    //C.MaxHealth *= 2;
                    Bounty *= 2;
                    xc     -= 1;

                    //  TG.Children.Add(new ScaleTransform(1.4, 1.4));

                    //TG.Children.Add(new RotateTransform(30));
                }

                if (xc >= 2 && Creep.Creeps.Count > 20)
                {
                    Health *= 2;
                    //C.MaxHealth *= 2;
                    Bounty *= 2;
                    xc     -= 2;

                    //TG.Children.Add(new ScaleTransform(1.4, 1.4));

                    //TG.Children.Add(new RotateTransform(30));
                }

                if (xc >= 4 && Creep.Creeps.Count > 30)
                {
                    Health *= 2;
                    //C.MaxHealth *= 2;
                    Bounty *= 2;
                    xc     -= 4;

                    //TG.Children.Add(new ScaleTransform(1.4, 1.4));

                    //TG.Children.Add(new RotateTransform(30));
                }


                Creep C = Creep.Spawn(Health, Bounty, Progress, Speed);
                C.Visibility = Visibility.Hidden;

                //C.InArena = Arena.instance;
                C.Fill            = new SolidColorBrush(Color.FromScRgb(1, (float)0, (float)(CreepInterval / 200), (float)(CreepWaveFactor - 1)));
                C.StrokeThickness = 3;
                //TG.Children.Add(new ScaleTransform(Math.Sqrt(CreepWaveFactor), Math.Sqrt(CreepWaveFactor)));

                // C.RenderTransform = TG;


                // C.Width = 200;
                //  C.Height = 200;


                // Creep.Creeps.Add(C);

                // C.RenderTransformOrigin = new Point(.5, .5);
                //C.FollowPath = Arena.instance.VisableTrack;
                //C.FollowPathLength = Arena.instance.TrackLength;
                // C.Tick();
                // Window1.instance._Lives.Content = Arena.instance.Creeps;
            }
        }