Beispiel #1
0
        private void MoveHero(Hero hero, Cell cell)
        {
            // no more movement points
            if (hero._movementPointLeft <= 0) return;

            // move hero
            {
                hero._cell._hero = null;
                hero._cell = cell;
                cell._hero = hero;

                hero._movementPointLeft -= 1;
                if (hero._movementPointLeft == 0)
                {
                    hero._image = _currentPlayer._heroImage;
                }
            }

            int goldMineType = (int)Heroes.Core.MineTypeEnum.Gold;

            if (cell._mine != null)
            {
                if (cell._mine._player == null)
                {
                    cell._mine._player = _currentPlayer;
                    cell._mine._image = _currentPlayer._goldMine;

                    _currentPlayer._mineKTypes[goldMineType].Add(cell._mine);

                    this.label_mines.Text = _currentPlayer._mineKTypes[goldMineType].Count.ToString();
                }
                else
                {
                    if (cell._mine._player == _currentPlayer)
                    { }
                    else
                    {
                        Player p = (Player)cell._mine._player;
                        p._mineKTypes[goldMineType].Remove(cell._mine);
                        cell._mine._player = _currentPlayer;
                        cell._mine._image = _currentPlayer._goldMine;
                        _currentPlayer._mineKTypes[goldMineType].Add(cell._mine);
                        this.label_mines.Text = _currentPlayer._mineKTypes[goldMineType].Count.ToString();
                    }
                }
                // replace image

                // change income
            }

            Draw();
        }
Beispiel #2
0
        void cell_MouseClick(object sender, MouseEventArgs e)
        {
            Cell cell = (Cell)sender;
            Debug.WriteLine(string.Format("{0},{1}", cell._row, cell._col));

            if (e.Button == MouseButtons.Left)
            {
                if (cell._hero != null)
                {
                    if (cell._hero._player.Equals(_currentPlayer))
                    {
                        _currentHero = (Hero)cell._hero;
                        _currentHero._image = _currentPlayer._heroSelect;
                        Draw();

                        //PplHeroInfo();
                    }

                    // cannot move to self
                    //if (cell._hero != null && cell._hero.Equals(hero)) return;
                }
                else
                {
                    this.dataGridView1.Rows.Clear();
                }
            }
            else
            {
                if (_currentHero == null) return;

                _currentHero._experience += 1000;
                if (_currentHero.IsLevelUp())
                {
                    frmLevelUp f = new frmLevelUp();
                    f.ShowDialog(_currentHero);
                }
            }
        }