예제 #1
0
 /// <summary>
 /// Конструктор башни
 /// </summary>
 public BombTower(Point position)
     : base
     (
         position,
         50.0,
         new SplinterBullet(position, null, new GameCell(15), 100.0, new GameCell(0.0)),
         double.NaN,
         new GameCell(3.5)
     )
 {
     Radius     = new GameCell(1.0);
     drawRadius = 1.05 * Radius.ToPixels();
 }
예제 #2
0
 public FreezeTower(Point position)
     : base
     (
         position,
         10.0,
         new FreezeBullet(position, null, new GameCell(7.0), new GameCell(0.0), 0.4, 2.0),
         1,
         new GameCell(4.0),
         new NotFreezedMonsterSelectionStrategy()
     )
 {
     Radius     = new GameCell(1);
     drawRadius = 1.05 * Radius.ToPixels();
 }
예제 #3
0
 /// <summary>
 /// Конструктор башни
 /// </summary>
 public MachinegunTower(Point position)
     : base
     (
         position,
         20.0,
         new MachinegunBullet(position, null, new GameCell(10.0), 10.0, new GameCell(0.0)),
         3.0,
         new GameCell(4.0)
     )
 {
     Radius        = new GameCell(1);
     drawRadius    = 1.05 * Radius.ToPixels();
     drawGunRadius = 0.9 * drawRadius;
     gunAngle      = 0.0;
 }
예제 #4
0
        /// <summary>
        /// Конструктор башни
        /// </summary>
        public LaserTower(Point position)
            : base
            (
                position,
                50.0,
                new LaserBullet(position, null, 100.0, new GameCell(0.0)),
                0.1,
                new GameCell(5.0)
            )
        {
            Radius        = new GameCell(1);
            drawRadius    = 1.05 * Radius.ToPixels();
            drawGunRadius = 1.0 * drawRadius;

            Random rnd = new Random();

            gunAngle = rnd.NextDouble() * 360.0;
        }
예제 #5
0
        /// <summary>
        /// Конструктор башни
        /// </summary>
        /// <param name="position">Положение башни</param>
        public SimpleTower(Point position)
            : base
            (
                position,
                10.0,
                new SimpleBullet(position, null, new GameCell(10.0), 10.0, new GameCell(0.0)),
                1.0,
                new GameCell(3.5)
            )
        {
            Radius        = new GameCell(1);
            drawRadius    = 1.05 * Radius.ToPixels();
            drawGunRadius = 1.0 * drawRadius;

            Random rnd = new Random();

            angle = rnd.NextDouble() * 360.0;
        }
예제 #6
0
        /// <summary>
        /// Действия по истечению тика
        /// </summary>
        public override void Tick(double interval)
        {
            if (Hit)
            {
                return;
            }

            double needAngle = HelperFunctions.GetAngleFromPointToPoint(Position, Target.Position);
            double needGoing = HelperFunctions.GetLength(Position, Target.Position);
            double mayGoing  = Speed.ToPixels() * interval;

            if (mayGoing < needGoing)
            {
                Position = Position
                           + new Vector(
                    +mayGoing * Math.Sin(Math.PI * needAngle / 180.0),
                    -mayGoing * Math.Cos(Math.PI * needAngle / 180.0)
                    );
                return;
            }
            else
            {
                Position = Target.Position;

                Hit = true;

                #region Наносим повреждения всем монстрам в зоне поражения
                foreach (Monster m in Game.Field.GetMonsters())
                {
                    if (HelperFunctions.GetLength(Position, m.Position) <= DamageRadius.ToPixels())
                    {
                        if (!m.Killed)
                        {
                            m.Hit(this);
                        }
                    }
                }
                #endregion
            }
        }
예제 #7
0
 /// <summary>
 /// "Жирный" конструктор
 /// </summary>
 public ImmuneMonster(Point position, Point target, GameCell speed, double life, double cost, double armour, double rotationSpeed)
     : base(position, 0, speed, life, cost, armour, target, 360.0)
 {
     Radius             = new GameCell(0.5);
     drawMonseterRaduis = Radius.ToPixels() * 1.4;
 }