Пример #1
1
        public ArtilleryTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMartillery;
            texture = world.texTowerArty;
            name = "Artillery Tower";
            fireSound = "artillery";
            volleyMode = true;
            range = 1250;
            dmg = 15;
            sDmg = 15;
            firingRate = 250.0f;
            pAcceleration = 0;
            imprecision = 40;
            maxMissiles = 30;
            missileInterval = 50;
            homing = false;
            pSpeed = 8.5f;
            sRange = 115;
            mmColor = Color.Orange;

            cost = 125;

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg = dmg;
            baseDamage = defaultDmg;
        }
Пример #2
0
        // The arrow tower is the most basic tower example.
        public ConcussionTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMconcussive;
            name = "Concussion Tower";
            fireSound = null;

            texture = world.texTowerConcussion;
            mmColor = Color.LightBlue;

            firingRate = 5000.0f;
            dmg = 0;
            range = 200;
            pSpeed = 5f;

            defaultFiringRate = firingRate;
            defaultDmg = dmg;
            defaultRange = range;

            cost = 25;

            SetDrawRectangle();
            pOrigin = new Vector2(center.X, center.Y - 35);
            firingTimer = firingRate;
        }
Пример #3
0
        public PulseTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMpulse;
            name = "Pulse Tower";
            fireSound = "Space Gun 01";
            texture = world.texTowerPulse;
            dmg = 100;
            range = 250;
            firingRate = 500.0f;
            missileInterval = 150.0f;
            mmColor = Color.OrangeRed;
            pSpeed = 25;
            volleyMode = true;
            maxMissiles = 3;
            homing = false;

            cost = 50;

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg =dmg;
            baseDamage = defaultDmg;

            SetDrawRectangle();
        }
Пример #4
0
        public GammaRayTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMgamma;
            fireSound = "gammabeam";
            name = "GammaRay Tower";
            texture = world.texTowerGammaRay;

            firingRate = 100f;
            dmg = 6;
            range = 200;
            imprecision = 0;
            pSpeed = 10;
            mmColor = Color.Red;

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg = dmg;
            baseDamage = defaultDmg;

            cost = 100;

            SetDrawRectangle();
            beamOrigin = new Rectangle((int)center.X, (int)center.Y, 8, 8);
            beamOrigin.Y -= 34;
            beamOriginV = new Vector2(beamOrigin.X, beamOrigin.Y);
        }
Пример #5
0
        public FlameTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMflame;
            texture = world.texTowerFlame;
            fireSound = "flamethrower";
            name = "Flame Tower";
            firingRate = 100;
            range = 100;
            imprecision = 16;
            homing = true;
            dmg = 3;
            sDmg = dmg;
            pSpeed = 2.0f;
            pAcceleration = 0;
            sInterval = 64;
            mmColor = Color.Yellow;

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg = dmg;
            baseDamage = defaultDmg;

            cost = 75;
            SetDrawRectangle();
        }
Пример #6
0
        protected Boolean volleyReady = false; // max number of missiles are ready

        #endregion Fields

        #region Constructors

        public RocketTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMrocket;
            name = "Rocket Tower";
            fireSound = "Rocket";
            texture = world.texTowerRocket;

            firingRate = 1000.0f;
            homing = true;
            dmg = 10;
            sDmg = dmg;
            sRange = 60;
            range = 600;
            pSpeed = 0.1f;
            pAcceleration = 0.2f;
            mmColor = new Color(255, 200, 0, 255);

            cost = 50;

            pOffset = (float)(0.25 * towerBase.Width);

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg = dmg;
            baseDamage = defaultDmg;

            SetDrawRectangle();
        }
Пример #7
0
        public Tower(World world, Rectangle towerBase, int health)
        {
            this.world = world;
            this.towerBase = towerBase;

            center = new Vector2(towerBase.Width / 2 + towerBase.X, towerBase.Height / 2 + towerBase.Y);

            this.health = health;
        }
Пример #8
0
        public Arrow(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.texArrow;
            hitAnimation = "red puff";
            missAnimation = "dirt puff";

            SetupProjectile();
            CalculateMovement();
        }
Пример #9
0
        int width, height; // width & height of projectile

        #endregion Fields

        #region Constructors

        // Constructor
        public Projectile(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
        {
            this.world = world;
            this.target = target;
            this.position = position;
            this.dmg = dmg;
            this.speed = speed;
            this.imprecision = imprecision;
            this.texProjectile = world.texArrow;
        }
Пример #10
0
 public AggressiveUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier, 
     Texture2D textureLiving, Texture2D textureDead, int value, int maxHP, World world,int damage, int range,
     float attackRate)
     : base(game, spawn, offset, movement, speed, tier, textureLiving, textureDead, value, maxHP)
 {
     this.tint = Color.Yellow;
     this.dSpeed *= 1.5f;
     this.speed = dSpeed;
     this.value = 2;
     this.world = world;
     this.damage = damage;
     this.range = range;
     this.attackRate = attackRate;
     this.attackTimer = 0.0f;
 }
Пример #11
0
        public GammaRay(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
            : base(world, position, target, dmg, speed, imprecision)
        {
            origin = position;
            //texProjectile = world.texRay;

            additive = false;
            scale = 0.4f;

            dType = "energy";

            color = new Color(0, 0, 0, 0);

            CalculateMovement();
            SetupProjectile();
        }
Пример #12
0
        public Bullet(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.texBullet;
            missAnimation = "dirt puff";
            hitAnimation = "red puff";

            additive = true;
            scale = 0.4f;
            dType = "pierce";

            color = new Color(255, 150, 150, 255);

            CalculateMovement();
            SetupProjectile();
        }
Пример #13
0
        public Pulse(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.texBullet;
            missAnimation = "redCircle";
            hitAnimation = "pulseHit";

            dType = "energy";
            acceleration = 0;
            additive = true;
            scale = 0.7f;

            color = new Color(255, 60, 60, 255);

            CalculateMovement();
            SetupProjectile();
        }
Пример #14
0
        public Concussion(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision, int netSize, float slowEffect, int duration)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.texConcussion;
            missAnimation = "concussion";
            hitAnimation = "concussion";
            splash = true;

            dType = "energy";

            this.netSize = netSize;
            this.slowEffect = slowEffect;
            this.duration = duration;

            CalculateMovement();
            SetupProjectile();
        }
Пример #15
0
        public ArrowTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            name = "Arrow Tower";
            texture = world.texTower;

            firingRate = 700.0f;
            dmg = 30;
            range = 150;
            imprecision = 7;
            pSpeed = 10;
            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg = dmg;

            SetDrawRectangle();
        }
Пример #16
0
        public Flame(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision, int sDmg,
            int sRange, float acceleration)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.texFire;
            hitAnimation = "explosion3";
            missAnimation = hitAnimation;

            dType = "burn";

            splash = true;
            this.sDmg = sDmg;
            this.sRange = sRange;
            this.homing = homing;
            this.acceleration = acceleration;

            SetupProjectile();
            CalculateMovement();
        }
Пример #17
0
        public FlyingUnit(KDefenseTower game, Crossroad spawn, Vector2 offset, Vector2 movement, float speed, int tier,
            Texture2D textureLiving, Texture2D textureDead, int value, int maxHP, World world)
            : base(game, spawn, offset, movement, speed,
            tier, textureLiving, textureDead, value, maxHP)
        {
            tint = Color.Yellow;
            dSpeed *= 1.5f;
            this.speed = dSpeed;
            this.value = 2;

            destination = world.Base.Crossroad;

            movement = new Vector2(0, 0);

            Vector2 toMove;
            float divisor;
            toMove = destination.Position - position;
            divisor = Math.Max(Math.Abs(toMove.X), Math.Abs(toMove.Y));
            movement = (toMove / divisor); // adjust movement vector
            tier = destination.tier; // set the unit's tier to its destination's tier
        }
Пример #18
0
        public Shell(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision, int sDmg,
            int sRange, float acceleration, Boolean homing)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.texRocket;

            hitAnimation = "explosion1";
            hitSound = "RndExplosion";
            missAnimation = hitAnimation;

            dType = "explosive";
            maxSpeed = 15;
            splash = true;

            this.sDmg = sDmg;
            this.sRange = sRange;
            this.homing = homing;
            this.acceleration = acceleration;

            SetupProjectile();
            CalculateMovement();
        }
Пример #19
0
        public CommandCenter(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMcommand;
            name = "Command";
            texture = world.texTowerCmdCenter;
            mmColor = Color.Gray;

            firingRate = 1.0f;
            defaultFiringRate = firingRate;

            dmg = 0;
            defaultDmg = dmg;

            range = 50;
            defaultRange = range;

            pSpeed = 0f;

            cost = 25;

            SetDrawRectangle();
        }
Пример #20
0
        protected Boolean barrelLeft = true; // first barrel to fire set to left

        #endregion Fields

        #region Constructors

        public MGTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMmg;
            name = "MG Tower";
            fireSound = "mg";
            texture = world.texTowerMG;
            dmg = 30;
            range = 175;
            firingRate = 70.0f;
            pSpeed = 15;
            imprecision = 12;

            cost = 50;
            mmColor = Color.Blue;

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg =dmg;
            baseDamage = defaultDmg;

            SetDrawRectangle();
        }
Пример #21
0
        public RifleTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.texMMrifle;
            fireSound = "rifle";
            name = "Rifle Tower";
            texture = world.texTowerRifle;

            firingRate = 700.0f;
            dmg = 30;
            range = 225;
            imprecision = 1;
            pSpeed = 18;
            mmColor = Color.Green;

            defaultRange = range;
            defaultFiringRate = firingRate;
            defaultDmg =dmg;
            baseDamage = defaultDmg;

            cost = 10;

            SetDrawRectangle();
        }
Пример #22
0
 public Base(World world, Crossroad lc)
 {
     this.area = lc.Area;
     this.world = world;
     this.last = lc;
 }
Пример #23
0
        protected override void Initialize()
        {
            base.Initialize();

            this.graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            this.graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            this.graphics.IsFullScreen = false;
            this.graphics.ApplyChanges();
            this.IsMouseVisible = true;

            this.audio = new Audio(this);
            this.Components.Add(audio);
            this.audio.Initialize();
            this.music = new Music(audio.soundBank, audio.engine);

            this.status = new Status();
            this.world = new World(this);
            this.ui = new UI(this);

            this.start = new Rectangle(Window.ClientBounds.Width - 300, Window.ClientBounds.Height - 102, 280, 82);
            this.tutorial = new Rectangle(10, Window.ClientBounds.Height - 102, 280, 82);
        }
Пример #24
0
 public void Restart()
 {
     status = new Status();
     world = new World(this);
     ui = new UI(this);
 }
Пример #25
0
        private int health = 20; // TODO : use hard mode

        #endregion Fields

        #region Constructors

        public Base(World world, Rectangle area)
        {
            this.area = area;
            this.world = world;
        }