Example #1
0
 public void Equip(Game.WeaponName weaponName)
 {
     foreach (Weapon w in this.Inventory)
     {
         if (w.Name == weaponName) fEquippedWeapon = w;
     }
 }
Example #2
0
        public Form1()
        {
            InitializeComponent();

            var boundaries = new Rectangle(78, 57, 420, 155);
            fGame = new Game(boundaries);
            fPicBoxesWeapons = new List<PictureBox>() { PicBoxBow, PicBoxPotionBlue, PicBoxSword, PicBoxMace, PicBoxPotionRed };
            fPicBoxesEnemies = new List<PictureBox>() { PicBoxBat, PicBoxGhost, PicBoxGhoul };
            fPicBoxesInventory = new List<PictureBox>() { PicBoxInvBow, PicBoxInvPotionBlue, PicBoxInvSword, PicBoxInvMace, PicBoxInvPotionRed };

            UpdateCharacters();
        }
Example #3
0
        public void Attack(Game.Direction direction, Random random)
        {
            if (fEquippedWeapon == null)
                return;
            else
            {
                fEquippedWeapon.Attack(direction, random);
                if (fEquippedWeapon is IPotion)

                    // might need to make sure some gui stuff gets done after this.
                    fEquippedWeapon = null;
            }
        }
Example #4
0
        protected bool DamageEnemy(Game game, Point playerLocation,
                                    Game.Direction direction, int distance, int damage, 
                                    Random rnd)
        {
            foreach (Enemy enemy in game.Enemies)
            {
                if (enemy.Nearby(playerLocation, distance, direction))
                    enemy.TakeHit(damage, rnd);
                    return true;
            }

            game.MovePlayer(direction);
            return false;
        }
Example #5
0
 public bool Nearby(Point locationToCheck, int distance, Game.Direction direction)
 {
     return true;
 }
Example #6
0
 public override void Attack(Game.Direction direction, Random rnd)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public abstract void Attack(Game.Direction direction, Random rnd);