Exemple #1
0
        public void MoveTo(Hero h, Location from, Location to)
        {
            if (h.CurrentLocationId != from.LocationId)
            {
                throw new ObjectNotHereException("Hero is not in location you want to move from");
            }

            if (_locationBll.CouldMoveTo(from, to) == false)
            {
                throw new CouldNotMoveException("There is no door to desired location");
            }

            h.CurrentLocationId = to.LocationId;
        }
        public void Init()
        {
            // TODO: Replace this with fake after real DB is conected
            _locationBll = new LocationBll(new LocationDal());
            _heroBll = new HeroBll(_locationBll);
            _hero = new Hero();

            /*
            *       Hope to get such map
            *               PUB
            *                 |
            *   SCHOOL <->  SQUARE  <-> GYM
            *                 |
            *               HOME
            */

            _home = new Location(1, "Home");
            _square = new Location(2, "Square");
            _school = new Location(3, "School");
            _pub = new Location(4, "Pub");
            _gym = new Location(5, "Gym");
        }