Example #1
0
        /// <summary>
        /// Жирный конструктор
        /// </summary>
        /// <param name="position"></param>
        /// <param name="target"></param>
        /// <param name="speed"></param>
        /// <param name="damage"></param>
        public MachinegunBullet(Point position, Monster target, GameCell speed, double damage, GameCell damageRadius)
            : base(position, target, speed, damage, damageRadius)
        {
            if (target != null)
            {
                double angleToTargetInRad = (Math.PI / 180.0) * HelperFunctions.GetAngleFromPointToPoint(Position, target.Position);
                Point  fromPoint          = Position + new Vector(Math.Sin(angleToTargetInRad), -Math.Cos(angleToTargetInRad)) * Game.Field.CellSize;

                Position = fromPoint;
            }
        }
Example #2
0
 /// <summary>
 /// "Жирный" конструктор
 /// </summary>
 public Monster(Point position, double angle, GameCell speed, double life, double cost, double armour, Point target, double rotationSpeed)
 {
     this.Position = position;
     this.Angle = angle;
     this.Speed = speed;
     this.Life = life;
     this.StartLife = life;
     this.Cost = cost;
     this.Armour = armour;
     this.Target = target;
     this.RotationSpeed = rotationSpeed;
 }
Example #3
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();
 }
 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();
 }
        /// <summary>
        /// Жирный конструктор
        /// </summary>
        /// <param name="position"></param>
        /// <param name="target"></param>
        /// <param name="speed"></param>
        /// <param name="damage"></param>
        public LaserBullet(Point position, Monster target, double damage, GameCell damageRadius)
            : base(position, target, new GameCell(double.PositiveInfinity), damage, damageRadius)
        {
            if (target != null)
            {
                double angleToTargetInRad = (Math.PI / 180.0) * HelperFunctions.GetAngleFromPointToPoint(Position, target.Position);

                Point fromPoint = Position + new Vector(Math.Sin(angleToTargetInRad), -Math.Cos(angleToTargetInRad)) * Game.Field.CellSize;

                DisappearanceLineGameAnimation hitAnimation =
                    new DisappearanceLineGameAnimation(fromPoint, Target.Position, 4.5, Colors.Red, 0.3, 0.9, 0.0);

                Game.Field.AddAnimation(hitAnimation);
            }
        }
Example #6
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;
 }
        /// <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;
        }
Example #8
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;
        }
Example #9
0
        /// <summary>
        /// Жирный конструктор
        /// </summary>
        /// <param name="position"></param>
        /// <param name="target"></param>
        /// <param name="speed"></param>
        /// <param name="damage"></param>
        public SplinterBullet(Point position, Monster target, GameCell speed, double damage, GameCell damageRadius)
            : base(position, target, speed, damage, damageRadius)
        {
            Random r = new Random();

            angle = r.NextDouble() * 360;
        }
Example #10
0
        /// <summary>
        /// Конструктор башни
        /// </summary>
        /// <param name="position">Положение башни</param>
        public Tower(Point position, double cost, Bullet bullet, double reloadingSpeed, GameCell attackRadius, MonsterSelectionStrategy monsterSelectionStrategy = null)
        {
            this.Position       = position;
            this.Cost           = cost;
            this.Bullet         = bullet;
            this.ReloadingSpeed = reloadingSpeed;
            this.AttackRadius   = attackRadius;

            if (monsterSelectionStrategy == null)
            {
                MonsterSelectionStrategy = new FirstMonsterSelectionStrategy();
            }
            else
            {
                MonsterSelectionStrategy = monsterSelectionStrategy;
            }

            State = GameObjectState.Simple;

            if (this is IUpgradeableTower)
            {
                (this as IUpgradeableTower).Level = 1;
            }
        }
 /// <summary>
 /// Жирный конструктор
 /// </summary>
 /// <param name="position"></param>
 /// <param name="target"></param>
 /// <param name="speed"></param>
 /// <param name="damage"></param>
 public FreezeBullet(Point position, Monster target, GameCell speed, GameCell damageRadius, double freezeFactor = 0.4, double freezeTime = 2.0)
     : base(position, target, speed, 0, damageRadius)
 {
     this.freezeFactor = freezeFactor;
     this.freezeTime   = freezeTime;
 }
Example #12
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;
 }
Example #13
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public ImmuneMonster(GameCell speed, double life = 200, double cost = 10.0, double armour = 5.0, double rotSpeed = 360.0)
     :  this(Game.Field.StartMonsterPosition, Game.Field.TargetMonsterPosition, speed, life, cost, armour, rotSpeed)
 {
 }
Example #14
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public DarkMonster(GameCell speed, double life = 1000.0, double cost = 50.0, double armour = 10.0, double rotSpeed = 270.0)
     :  this(Game.Field.StartMonsterPosition, Game.Field.TargetMonsterPosition, speed, life, cost, armour, rotSpeed)
 {
 }