예제 #1
0
 internal Session this[ListLocations location]
 {
     get
     {
         if (location == ListLocations.START)
         {
             return(Sessions[0]);
         }
         else if (location == ListLocations.END)
         {
             return(Sessions[Sessions.Count - 1]);
         }
         else
         {
             return(null);
         }
     }
     set
     {
         if (location == ListLocations.START)
         {
             Sessions[0] = value;
         }
         else if (location == ListLocations.END)
         {
             Sessions[Sessions.Count - 1] = value;
         }
     }
 }
예제 #2
0
        private void UpdateMinimap()
        {
            for (int i = 0; i < MinimapGrid.Rows.Count; i++)
            {
                for (int j = 0; j < MinimapGrid.ColumnCount; j++)
                {
                    var checkCell = MinimapGrid.Rows[i].Cells[j];
                    checkCell.Style.BackColor = System.Drawing.Color.White;
                    checkCell.Value           = "";
                    ILocation loc = ListLocations.GetLocAt(_player.PosX - (i - 2), (j - 2) + _player.PosY);

                    if (loc != null)
                    {
                        if (loc.Revealed)
                        {
                            checkCell.Value = loc.Name;
                        }
                        else
                        {
                            if (loc.Discovered)
                            {
                                checkCell.Value           = "???";
                                checkCell.Style.BackColor = System.Drawing.Color.White;
                            }
                            else
                            {
                                checkCell.Value           = "";
                                checkCell.Style.BackColor = System.Drawing.Color.Black;
                            }
                        }
                    }
                    else
                    {
                        checkCell.Value           = "";
                        checkCell.Style.BackColor = System.Drawing.Color.Black;
                    }
                }
            }
            MinimapGrid.Rows[2].Cells[2].Value    = _player.PlayerLocation.Name;
            MinimapGrid.Rows[2].Cells[2].Selected = true;
        }
예제 #3
0
 public ListlocationsController(ListLocations requestService)
 {
     _requestService = requestService;
 }
예제 #4
0
        private void MoveTo(char dir)
        {
            ILocation loc = _player.PlayerLocation;

            if (!_player.Dead)
            {
                if (!_player.Combat)
                {
                    switch (dir)
                    {
                    case 'n':
                        if (ListLocations.GetLocAt(_player.PosX + 1, _player.PosY) != null)
                        {
                            _player.PosX++;
                        }
                        break;

                    case 'e':
                        if (ListLocations.GetLocAt(_player.PosX, _player.PosY + 1) != null)
                        {
                            _player.PosY++;
                        }
                        break;

                    case 's':
                        if (ListLocations.GetLocAt(_player.PosX - 1, _player.PosY) != null)
                        {
                            _player.PosX--;
                        }
                        break;

                    case 'w':
                        if (ListLocations.GetLocAt(_player.PosX, _player.PosY - 1) != null)
                        {
                            _player.PosY--;
                        }
                        break;

                    default:
                        break;
                    }

                    _player.PlayerLocation = ListLocations.GetLocAt(_player.PosX, _player.PosY);

                    if (_player.PlayerLocation.MonsterHere != null)
                    {
                        _player.PlayerLocation.SpawnedMonster = new Monster(_player.PlayerLocation.MonsterHere);
                    }
                    infoBox.Text = Utils.LocInfoWriter(_player);
                }
                else
                {
                    infoBox.Text = "You can't run while fighting a monster!\n\n" + "You see a "
                                   + loc.MonsterHere.Name + " " + "(" + loc.SpawnedMonster.HpCur + "/" + loc.MonsterHere.HpMax + " HP).";
                }
            }
            UpdateInventory();
            _player.PlayerLocation.Revealed = true;

            #region set adjacent locations to discovered
            try
            {
                ListLocations.GetLocAt(_player.PosX, _player.PosY + 1).Discovered = true;
            }
            catch { }

            try
            {
                ListLocations.GetLocAt(_player.PosX, _player.PosY - 1).Discovered = true;
            }
            catch { }

            try
            {
                ListLocations.GetLocAt(_player.PosX + 1, _player.PosY).Discovered = true;
            }
            catch { }

            try
            {
                ListLocations.GetLocAt(_player.PosX - 1, _player.PosY).Discovered = true;
            }
            catch { }
            #endregion

            UpdateMinimap();
        }