Пример #1
0
        public GameManager()
        {
            _player = new Character("Haru", 20, 10, 10);

            _player.Equipped.Equip(InventorySlotId.WEAPON, new BronzeSword());
            _player.Equipped.Equip(InventorySlotId.CHESTPIECE, new BronzeChestpiece());
            _player.Equipped.Equip(InventorySlotId.HELMET, new BronzeHelmet());
            _player.Equipped.Equip(InventorySlotId.GRIEVES, new BronzeGrieves());
            _player.Equipped.Equip(InventorySlotId.VAMBRACES, new BronzeVambraces());

            _randomItemFactory = new RandomItemFactory();
            _enemyFactory      = new RandomEnemyFactory();
            _random            = new Random();
            smallHealPotion    = new SmallPotion();

            _enemy    = null; //_enemyFactory.GenerateRandomEnemy();
            _gameOver = false;
            _youWin   = false;
            _depth    = 1;
            _xp       = 0;
            _light    = 20;
        }
Пример #2
0
        public CombatScreen(GameManager gm)
        {
            InitializeComponent();
            _gm = gm;
            displayLevel.Text = "XP";
            _randomItem       = new RandomItemFactory();
            depthCounter.Text = Convert.ToString(_gm.Depth);

            torchPictureBox.Image = Properties.Resources.Torch;
            lightCount.Text       = "Light " + "" + _gm.light.ToString();

            enemyPictureBox.Image = _gm.Enemy.Image;
            _image = Properties.Resources.Haru;

            playerPictureBox.Image = _image;

            xpProgressBar.Minimum = 0;
            xpProgressBar.Maximum = 100;

            enemyProgressBar.Value  = _gm.Enemy.CurrentHealth;
            playerProgressBar.Value = _gm.Player.CurrentHealth;

            string playerHpStatus = Convert.ToString(_gm.Player.CurrentHealth);
            string enemyHpStatus  = Convert.ToString(_gm.Enemy.CurrentHealth);

            playerHealth.Text = playerHpStatus;
            enemyHealth.Text  = enemyHpStatus;

            NextRoomBtn.Visible     = false;
            playerName.Text         = _gm.Player.Name;
            enemyName.Text          = _gm.Enemy.Name;
            enemyAttackValue.Text   = "Attack - " + _gm.Enemy.CalcTotalAttackValue();
            playerAttackValue.Text  = "Attack Value - " + _gm.Player.CalcTotalAttackValue();
            playerDefenseValue.Text = "Defense Value - " + _gm.Player.CalcTotalDefenseValue();
            enemyDefenseValue.Text  = "Defense Value - " + _gm.Enemy.CalcTotalDefenseValue();



            if (_gm.light < 5)
            {
                torchPictureBox.Image = null;
                BackColor             = Color.DarkGray;
            }

            xpProgressBar.Value = _gm.XP;
            int levelUpStatus = xpProgressBar.Value;

            xpDisplay.Text = string.Format("{0}/100", levelUpStatus);

            displayLevel.Text = string.Format("Level {0}", _gm.LevelUp);



            if (_gm.Depth == 5)
            {
                _gm.EnemyFactory.SpawnMiniBoss();
            }

            if (_gm.Depth == 10)
            {
            }

            if (_gm.Depth == 20)
            {
                _gm.EnemyFactory.SpawnBoss();

                if (_gm.Enemy.IsDead)
                {
                    NextRoomBtn.Text = "YOU WIN";
                    var youWinScreen = new YouWin();
                    youWinScreen.Dock = DockStyle.Fill;
                    Controls.Add(youWinScreen);
                }
            }


            if (_gm.YouWin == true)
            {
                var youWinScreen = new YouWin();
                youWinScreen.Dock = DockStyle.Fill;
                Controls.Add(youWinScreen);
            }

            if (_gm.Depth > 5)
            {
                BackColor = Color.Gray;
            }
        }
        // FIXME: these factory methods putting armor into the weapon slot

        public RandomEnemyFactory()
        {
            _random      = new Random();
            _itemFactory = new RandomItemFactory();
        }