public void PlayShootOrThrowSound(RangedWeaponType weaponType)
 {
     if (weaponType == RangedWeaponType.Bow || weaponType == RangedWeaponType.Crossbow)
     {
         PlayRandomSound(bowReleaseSounds);
     }
     else if (weaponType == RangedWeaponType.Spear)
     {
         PlayRandomSound(throwSounds);
     }
     else if (weaponType == RangedWeaponType.Fireball)
     {
         PlayRandomSound(fireballCastSounds);
     }
     else if (weaponType == RangedWeaponType.HealingOrb)
     {
         PlayRandomSound(healingOrbCastSounds);
     }
 }
 public void PlayRangedHitSound(RangedWeaponType weaponType, bool isAttackingBuilding)
 {
     if (weaponType == RangedWeaponType.Fireball)
     {
         PlayRandomSound(fireballHitSounds);
     }
     else if (weaponType == RangedWeaponType.HealingOrb)
     {
         return; // PlayRandomSound(healingOrbHitSounds);
     }
     else
     {
         if (isAttackingBuilding == false)
         {
             PlayRandomSound(arrowHitOpponentSounds);
         }
         else
         {
             PlayRandomSound(arrowHitWallSounds);
         }
     }
 }
        public RangedWeapon(RangedWeaponType rangedWeaponType, int x = 0, int y = 0) : base(x, y)
        {
            //ANOTHER CONSTRUCTOR IS NEEDED

            if (rangedWeaponType == RangedWeaponType.RIFLE)
            {
                durability = 3;
                damage     = 5;
                cost       = 7;
                range      = 3;
                name       = "Rifle";
            }

            else if (rangedWeaponType == RangedWeaponType.LONGBOW)
            {
                durability = 4;
                range      = 2;
                damage     = 4;
                cost       = 6;
                name       = "LongBow";
            }
            range = 1;
        }
示例#4
0
        /// <summary>
        /// Creates a new weapon given a range for damage hit points.
        /// </summary>
        /// <param name="name">The <code>RangedWeapon</code>'s name.</param>
        /// <param name="minDamage">The <code>RangedWeapon</code>'s minimum damage.</param>
        /// <param name="maxDamage">The <code>RangedWeapon</code>'s maximum damage.</param>
        /// <param name="type">The <code>RangedWeapon</code>'s <code>RangedWeaponType</code>.</param>
        /// <param name="minAOERadius">Minimum AOE (area-of-effect) radius.
        /// Set this to 0 if the <code>RangedWeapon</code> does not employ AOE.
        /// </param>
        /// <param name="maxAOERadius">Maximum AOE (area-of-effect) radius.
        /// Set this to 0 if the <code>RangedWeapon</code> does not employ AOE.
        /// </param>
        public RangedWeapon(string name,
							int minDamage,
							int maxDamage,
							RangedWeaponType type,
							int minAOERadius = 0,
							int maxAOERadius = 0)
            : base(name, minDamage, maxDamage)
        {
            //Name = name;
            //MinimumDamage = minDamage;
            //MaximumDamage = maxDamage;
            Type = type;
            MinimumAOERadius = minAOERadius;
            MaximumAOERadius = maxAOERadius;
        }
示例#5
0
        /// <summary>
        /// Creates a new <code>RangedWeapon</code> with the specified damage. The damage of the <code>RangedWeapon</code> will be static.
        /// </summary>
        /// <param name="name">The <code>RangedWeapon</code>'s name.</param>
        /// <param name="damage">The <code>RangedWeapon</code>'s damage.</param>
        /// <param name="type">The <code>RangedWeapon</code>'s <code>RangedWeaponType</code>.</param>
        /// <param name="minAOERadius">Minimum AOE (area-of-effect) radius.
        /// Set this to 0 if the <code>RangedWeapon</code> does not employ AOE.
        /// </param>
        /// <param name="maxAOERadius">Maximum AOE (area-of-effect) radius.
        /// Set this to 0 if the <code>RangedWeapon</code> does not employ AOE.
        /// </param>
        public RangedWeapon(string name,
							int damage,
							RangedWeaponType type,
							int minAOERadius = 0,
							int maxAOERadius = 0)
            : this(name, damage, damage, type, minAOERadius, maxAOERadius)
        {
            //Name = name;
            //MinimumDamage = damage;
            //MaximumDamage = damage;
            //Type = type;
            //MinimumAOERadius = minAOERadius;
            //MaximumAOERadius = maxAOERadius;
        }
示例#6
0
        private Tile Create(TileType type)
        {
            int x = random.Next(0, width);
            int y = random.Next(0, height);


            while (map[x, y].Type != TileType.EMPTY)
            {
                x = random.Next(0, width);
                y = random.Next(0, height);
            }

            if (type == TileType.HERO)
            {
                map[x, y] = new Hero(x, y, 10);
                return(map[x, y]);
            }
            else if (type == TileType.ENEMY)
            {
                int i = random.Next(0, 3);
                if (i == 1)
                {
                    map[x, y] = new Goblin(x, y);
                    return(map[x, y]);
                }
                else if (i == 2)
                {
                    map[x, y] = new Mage(x, y);
                    return(map[x, y]);
                }
                else
                {
                    Leader leader = new Leader(x, y);
                    leader.Target = hero;
                    map[x, y]     = leader;
                    return(map[x, y]);
                }
            }
            else if (type == TileType.GOLD)
            {
                map[x, y] = new Gold(x, y);
                return(map[x, y]);
            }

            else if (type == TileType.WEAPON)
            {
                int weaponType    = random.Next(0, 2);
                int weaponVariant = random.Next(0, 2);

                if (weaponType == 0)
                {
                    RangedWeaponType rangedType = (RangedWeaponType)weaponVariant;
                    map[x, y] = new RangedWeapon(rangedType, x, y);
                }
                else
                {
                    MeleeWeaponType meleeType = (MeleeWeaponType)weaponVariant;
                    map[x, y] = new MeleeWeapon(meleeType, x, y);
                }

                return(map[x, y]);
            }

            return(new EmptyTile(x, y));
        }