示例#1
0
        /// <summary>
        /// Creates a new weapon.
        /// </summary>
        /// <param name="owner">The game entity which possesses this weapon.</param>
        /// <param name="damage">The amount of damage the weapon does.</param>
        /// <param name="firingInterval">The time, in seconds, between shots.</param>
        /// <param name="projectileSpeed">The speed, in game units, at which the projectile fired by this weapon travels.</param>
        /// <param name="turningRadius">The arc, in degrees, that this weapon can fire in. Assumes bidirectional.</param>
        /// <param name="turnSpeed">The speed at which the weapon can be turned along the turningRadius.</param>
        public Weapon(double damage, double turningRadius, double turnSpeed)
        {
            this.damage = damage;
            this.projectileSpeed = projectileSpeed;
            this.turningRadius = turningRadius;
            this.turningSpeed = turnSpeed;
            this.maxAmmo = 100;

            //set the default projectile
            this.projectileTemplate = new Projectile("Bullet", null, null);
            this.projectileTemplate.SetDamage(1);
            this.lastFiredTime = DateTime.Now;

            //set the default projectile to bullet?
        }
示例#2
0
 public void SetProjectile(Projectile projectileTemplate)
 {
     this.projectileTemplate = projectileTemplate;
 }
示例#3
0
        public void prepTowers()
        {
            LivingGameEntity NyanTower = new LivingGameEntity("NyanTower");
            LivingGameEntity XTheYTower = new LivingGameEntity("XTheYTower");
            LivingGameEntity TableFlipperTower = new LivingGameEntity("TableFlipperTower");
            LivingGameEntity BarrelRollTower = new LivingGameEntity("BarrelRollTower");
            LivingGameEntity ArrowKneeTower = new LivingGameEntity("GuardTower");

            LivingGameEntity PepperCopTower = new LivingGameEntity("PepperCopTower");

            //NyanTower.SetResource("Currency", 15);
            //PepperCopTower.SetResource("Currency", 35);
            //XTheYTower.SetResource("Currency", 40);
            //TableFlipperTower.SetResource("Currency", 20);

            //this will automatically draw the sprite for the projectile from the (hopefully) pre-established table sprite
            Projectile TableProjectile = new Projectile("Table");
            TableProjectile.SetDamage(30);

            Weapon TableFlipperWeapon = new Weapon(10, 1, .5, 180, 40);
            TableFlipperWeapon.SetProjectile(TableProjectile);
            TableFlipperWeapon.SetRange(5);
            TableFlipperTower.AddWeapon(TableFlipperWeapon);

            Weapon dummyWeapon = new Weapon(10, 1, .5, 180, 40);
            dummyWeapon.SetRange(5);
            NyanTower.AddWeapon(dummyWeapon);

            Projectile barrel = new Projectile("Barrel");
            barrel.SetDamage(70);

            Weapon BarrelThrower = new Weapon(10, 1, .5, 180, 40);
            BarrelThrower.SetRange(5);
            BarrelThrower.SetProjectile(barrel);
            BarrelRollTower.AddWeapon(BarrelThrower);

            Projectile arrow = new Projectile("Arrow");
            arrow.SetDamage(70);

            Weapon Bow = new Weapon(10, 1, .5, 180, 40);
            Bow.SetRange(15);
            Bow.SetProjectile(arrow);
            ArrowKneeTower.AddWeapon(Bow);
        }