Beispiel #1
0
        static void Main(string[] args)
        {
            Random = new RogueSharp.Random.DotNetRandom(seed);

            // create output system
            string fontFileName = "terminal8x8.png";
            string consoleTitle = $"ECS Test Level = {_mapLevel}";

            _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight,
                                             8, 8, 1f, consoleTitle);
            _mapConsole       = new RLConsole(_mapWidth, _mapHeight);
            _messageConsole   = new RLConsole(_messageWidth, _messageHeight);
            _statConsole      = new RLConsole(_statWidth, _statHeight);
            _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight);

            // create systems, entityManager first
            EntityManager = new Systems.EntityManager(_mapWidth, _mapHeight);

            CommandSystem = new Systems.CommandSystem();
            MessageLog    = new Systems.MessageLog();

            SystemsManager  = new Systems.SystemManager(EntityManager);
            RenderSystem    = new Systems.RenderSystem(EntityManager);
            ShedSystem      = new Systems.SchedulingSystem();
            UseSystem       = new Systems.UseSystem(EntityManager);
            InventorySystem = new Systems.InventorySystem(EntityManager);

            //listen for critical events
            Core.EventBus.Subscribe(Core.EventTypes.GameCritical, (sender, e) => OnMessage(e));


            //MessageLog.Add("Rogue At level 1");

            //create map stuff
            Systems.MapGenerator mapGenerator = new Systems.MapGenerator(_mapWidth,
                                                                         _mapHeight, 25, 20, 7, _mapLevel, EntityManager);
            DungeonMap      = mapGenerator.CreateMap();
            MovementSystem  = new Systems.MovementSystem(DungeonMap, EntityManager);
            CollisionSystem = new Systems.CollisionSystem(EntityManager, DungeonMap);

            // place monsters
            mapGenerator.PlaceMonsters(EntityManager);
            mapGenerator.PlaceGold(EntityManager);

            //run initial FOV for monsters
            //DungeonMap.UpdateFOVForMonsters(EntityManager);

            //creat garbage system
            GarbageSystem = new Systems.GarbageSystem(ShedSystem, EntityManager, DungeonMap);

            //create AI system
            AISystem = new Systems.AISystem(EntityManager, DungeonMap, GarbageSystem);

            _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Core.Swatch.DbWood);
            _inventoryConsole.Print(1, 1, "Inventory", Core.Colours.TextHeading);

            _rootConsole.Update += OnRootConsoleUpdate;
            _rootConsole.Render += OnRootConsoleRender;
            _rootConsole.Run();
        }
Beispiel #2
0
 public GarbageSystem(SchedulingSystem shed, EntityManager em, Core.DungeonMap dm)
 {
     _shedSystem    = shed;
     _entityManager = em;
     _dungeonMap    = dm;
     _entsToDelete  = new List <int>();
     Core.EventBus.Subscribe(Core.EventTypes.DeleteEntity, (sender, e) => OnMessage(e));
     Core.EventBus.Subscribe(Core.EventTypes.DeadEntity, (sender, e) => OnMessage(e));
 }