예제 #1
0
        public Dungeon(RealmInfomation realm_infomation)
        {
            _RealmInfomation = realm_infomation;
            _Valid = true;
            _Map = new Map();
            _WaitingRoom = new List<Entity>();
            _Updater = new TimesharingUpdater(1.0f / 30.0f);
            _Aboriginals = new List<Aboriginal>();

            _EntityEnteranceResource = realm_infomation.EntityEnteranceResource;
            /*_EntityEnteranceResource = new Dictionary<ENTITY, int>
            {
                { ENTITY.ACTOR1, 10},
                { ENTITY.ACTOR2, 20},
                { ENTITY.ACTOR3, 20},
                { ENTITY.ACTOR4, 20},
                { ENTITY.ACTOR5, 20},
            };*/
            _EntityFieldResource = realm_infomation.EntityFieldResource;
            /*_EntityFieldResource = new Dictionary<ENTITY, int>
            {
                { ENTITY.ACTOR1, 10},
                { ENTITY.ACTOR2, 10},
                { ENTITY.ACTOR3, 10},
                { ENTITY.ACTOR4, 10},
                { ENTITY.ACTOR5, 10},
            };*/

            _LevelUnitToGroupBuilder = new Dictionary<Data.LEVEL_UNIT, EntityGroupBuilder>();
            foreach (var mazeUnitInfomation in _RealmInfomation.Maze.MazeUnits)
            {
                _LevelUnitToGroupBuilder.Add(mazeUnitInfomation.Type , new EntityGroupBuilder(mazeUnitInfomation.Name, _Map, this));
            }
        }
예제 #2
0
        public void TestMapFind()
        {
            Map map = new Map();

            Rect rect = new Rect(0.5f ,5,1,10);

            Polygon meshs1 = new Polygon(new[]{
                new Vector2(1, 1),
                new Vector2(2, 1),
                new Vector2(2, 2),
                new Vector2(1, 2)
            });
            Polygon meshs2 = new Polygon(new[]{
                new Vector2(1, 1),
                new Vector2(2, 1),
                new Vector2(2, 2),
                new Vector2(1, 2)
            });
            Polygon meshs3 = new Polygon(new[]{
                new Vector2(1, 1),
                new Vector2(2, 1),
                new Vector2(2, 2),
                new Vector2(1, 2)
            });
            Polygon meshs4 = new Polygon(new[]{
                new Vector2(1, 1),
                new Vector2(2, 1),
                new Vector2(2, 2),
                new Vector2(1, 2)
            });
            Polygon meshs5 = new Polygon(new[]{
                new Vector2(1, 1),
                new Vector2(2, 1),
                new Vector2(2, 2),
                new Vector2(1, 2)
            });

            meshs2.Offset(0,2);

            meshs3.Offset(0, 4);

            meshs4.Offset(0, 6);

            meshs5.Offset(0, 8);

            IIndividual[] visables = {
                new Entity(meshs1),
                new Entity(meshs2),
                new Entity(meshs3),
                new Entity(meshs4),
                new Entity(meshs5)
            };

            foreach (var visable in visables)
            {
                map.JoinStaff(visable);
            }
            IMapFinder finder = map;
            var results = finder.Find(rect);

            foreach (var visable in visables)
            {
                map.Left(visable);
            }

            Assert.AreEqual(5, results.Length);
        }
예제 #3
0
        private void _BuildTown(Map map)
        {
            if (_RealmInfomation.HaveTown() == false)
                return;

            var layout = new EntityGroupBuilder(_RealmInfomation.Town.Name, map, this);
            foreach (var updatable in layout.Create(0, new Vector2()))
            {
                _Updater.Add(updatable);
            }
        }
예제 #4
0
 private Aboriginal _Create(Map map,ENTITY type, ItemProvider item_provider)
 {
     var entiry = EntityProvider.Create(type);
     var items = item_provider.FromStolen();
     foreach (var item in items)
     {
         entiry.Bag.Add(item);
     }
     var wisdom = new StandardWisdom(entiry);
     var aboriginal = new Aboriginal(map, this, entiry, wisdom);
     return aboriginal;
 }
예제 #5
0
        private void _BuildMaze(Map map)
        {
            var level = _CreateLevel();

            foreach (var unit in level)
            {
                var builder = _LevelUnitToGroupBuilder[unit.Type];
                var updaters = builder.Create(unit.Direction, unit.Center);

                foreach (var updatable in updaters)
                {
                    _Updater.Add(updatable);
                }
            }
        }