void Init() { int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); PlayerStat = GameObject.Find("playerStat"); EquipmentItems = GameObject.Find("equipmentItems"); AbilitiesItems = GameObject.Find("abilitiesItems"); ItemItems = GameObject.Find("itemItems"); MonsterStat = GameObject.Find("monsterStat"); MonsterItem = Resources.Load <GameObject>("Prefabs/monsterItem"); text = GameObject.Find("massageText").GetComponent <Text>(); text.color = Color.white; MessageLog = new MessageLog(); SchedulingSystem = new SchedulingSystem(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add(string.Format("Level created with seed '{0}'", seed)); groundTiles = new GameObject[_width, _height]; ItemsTiles = new Entry[_width, _height]; boardHolder = new GameObject("boardHolder").transform; itemsHolder = new GameObject("itemsHolder").transform; effectsHolder = new GameObject("effectsHolder").transform; CommandSystem = new CommandSystem(); TargetingSystem = new TargetingSystem(); }
public static void Main() { string fontFileName = "terminal8x8.png"; string consoleTitle = "RougeSharp RLNet Tutorial - Level 1"; int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add($"Level created with seed '{seed}'"); Player = new Player(); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); _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); CommandSystem = new CommandSystem(); TargetingSystem = new TargetingSystem(); Player.Item1 = new RevealMapScroll(); Player.Item2 = new RevealMapScroll(); _rootConsole.Update += OnRootConsoleUpdate; _rootConsole.Render += OnRootConsoleRender; _rootConsole.Run(); }
public ObjectManager(SchedulingSystem schedulingSystem, MappingService mappingService) { this.mapGenerator = new MapGenerator(mappingService); this.charGenerator = new CharacterGenerator(mappingService); this.schedulingSystem = schedulingSystem; }
public RogueGame() { string consoleTitle = "RougeSharp SadConsole Example Game - Level 1"; int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add($"Level created with seed '{seed}'"); Player = new Player(); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); CommandSystem = new CommandSystem(); TargetingSystem = new TargetingSystem(); Player.Item1 = new RevealMapScroll(); Player.Item2 = new RevealMapScroll(); _inputState = new InputState(); _graphics = new GraphicsDeviceManager(this); this.Window.Title = consoleTitle; Content.RootDirectory = "Content"; var sadConsoleComponent = new SadConsole.EngineGameComponent(this, () => { using (var stream = System.IO.File.OpenRead("Fonts/Cheepicus12.font")) SadConsole.Engine.DefaultFont = SadConsole.Serializer.Deserialize <SadConsole.Font>(stream); SadConsole.Engine.DefaultFont.ResizeGraphicsDeviceManager(_graphics, _screenWidth, _screenHeight, 0, 0); SadConsole.Engine.UseMouse = true; SadConsole.Engine.UseKeyboard = true; _mapConsole = new Console(_mapWidth, _mapHeight); _messageConsole = new Console(_messageWidth, _messageHeight); _statConsole = new Console(_statWidth, _statHeight); _inventoryConsole = new Console(_inventoryWidth, _inventoryHeight); _mapConsole.Position = new Point(0, _inventoryHeight); _messageConsole.Position = new Point(0, _screenHeight - _messageHeight); _statConsole.Position = new Point(_mapWidth, 0); _inventoryConsole.Position = new Point(0, 0); SadConsole.Engine.ConsoleRenderStack.Add(_mapConsole); SadConsole.Engine.ConsoleRenderStack.Add(_messageConsole); SadConsole.Engine.ConsoleRenderStack.Add(_statConsole); SadConsole.Engine.ConsoleRenderStack.Add(_inventoryConsole); SadConsole.Engine.ActiveConsole = _mapConsole; }); Components.Add(sadConsoleComponent); }
public void Reset() { int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); //MessageLog.Clear(); SchedulingSystem.Clear(); gameOver = false; }
public void GeneratePlayer(int mapId, int playerId, SchedulingSystem schedulingSystem) { var mapDto = this.mappingService.GetDungeonDtoById(mapId); var playerDto = this.mappingService.GetPlayerDtoById(playerId); mapDto.SetIsWalkable(playerDto.X, playerDto.Y, false); mapDto.UpdatePlayerFieldOfView(playerDto); schedulingSystem.Add(playerDto); }
private void Start() { schedule = FindObjects.GameLogic.GetComponent <SchedulingSystem>(); wizard = FindObjects.GameLogic.GetComponent <WizardMode>(); init = FindObjects.GameLogic.GetComponent <Initialize>(); coord = FindObjects.GameLogic.GetComponent <ConvertCoordinates>(); actor = FindObjects.GameLogic.GetComponent <ActorBoard>(); gameMode = FindObjects.GameLogic.GetComponent <SubMode>(); modeline = FindObjects.GameLogic.GetComponent <UIModeline>(); input = GetComponent <PlayerInput>(); }
public Container() { CommandSystem = new CommandSystem(); SchedulingSystem = new SchedulingSystem(); //Inventory = new InventoryConsole(InventorySize.X, InventorySize.Y); Belt = new BeltConsole(BeltSize.X, BeltSize.Y); Log = new MessageLogConsole(LogSize.X, LogSize.Y); Adventure = new Adventure(AdventureSize.X, AdventureSize.Y); MoveNextConsole(); }
public void GenerateMonsters(int mapId, SchedulingSystem schedulingSystem) { var dungeonDto = this.mappingService.GetDungeonDtoById(mapId); var monsterDtos = dungeonDto.Monsters; foreach (var monsterDto in monsterDtos) { dungeonDto.SetIsWalkable(monsterDto.X, monsterDto.Y, false); schedulingSystem.Add(monsterDto); } }
public Game(UI.Main screen) { int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); CommandSystem = new CommandSystem(this); Logger = new Systems.Logger(this); SchedulingSystem = new SchedulingSystem(this); TargetingSystem = new TargetingSystem(this); this.screen = screen; screen.UpdateRender += OnUpdate; }
static void Main() { // Establish the seed for the random number generator from the current time int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); // This must be the exact name of the bitmap font file we are using or it will error. string fontFileName = "terminal8x8.png"; // The title will appear at the top of the console window string consoleTitle = $"RougeSharp V3 Tutorial - Level 1 - Seed {seed}"; // Tell RLNet to use the bitmap font that we specified and that each tile is 8 x 8 pixels _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); // Initialize the sub consoles that we will Blit to the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight); CommandSystem = new CommandSystem(); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add($"Level created with seed '{seed}'"); // Set up a handler for RLNET's Update event _rootConsole.Update += OnRootConsoleUpdate; // Set up a handler for RLNET's Render event _rootConsole.Render += OnRootConsoleRender; // Set background color and text for each console // so that we can verify they are in the correct positions _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Swatch.DbWood); _inventoryConsole.Print(1, 1, "Inventory", Colors.TextHeading); // Begin RLNET's game loop _rootConsole.Run(); }
public static void Play() { string fontFileName = "terminal16x16_gs_ro.png"; // for testing use 1138043851 Random = new DotNetRandom(seed); //TODO: Take seed out after debugging string consoleTitle = $"D$ DungeonZ Level {_mapLevel} - Seed {seed}"; //setup systems SchedulingSystem = new SchedulingSystem(); CommandSystem = new CommandSystem(); MessageLog = new MessageLog(); Player = new Player(); // Dont change map width or height //Attempting to make 20 rooms that are between 5 and 13 cells for room size MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 50, 5, 13, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); // first numbers effect tile size _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 16, 16, 1.5f, consoleTitle); _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight); //these console methods have to be run before the update and render below _mapConsole.SetBackColor(0, 0, _mapWidth, _mapHeight, Colors.FloorBackground); _mapConsole.Print(1, 1, "Map", Colors.TextHeading); // Create a new MessageLog and print the random seed used to generate the level MessageLog.Add($"{Player.Name} arrives on level 1"); MessageLog.Add($"Level created with seed '{seed}'"); // Remove these lines: _messageConsole.SetBackColor(0, 0, _messageWidth, _messageHeight, Swatch.DbDeepWater); _messageConsole.Print(1, 1, "Messages", Colors.TextHeading); _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Swatch.DbWood); _inventoryConsole.Print(1, 1, "Inventory", Colors.TextHeading); // have to register events for RLNet for update and render _rootConsole.Update += OnRootConsoleUpdate; _rootConsole.Render += OnRootConsoleRender; _rootConsole.Run(); }
public static void Main() { //Console.WriteLine("Good luck, you will need it."); string fontFileName = "terminal8x8.png"; int seed = (int)DateTime.UtcNow.Ticks; string consoleTitle = $"RoguelikeGame - Level {MapLevel}"; Random = new DotNetRandom(seed); MessageLog = new MessageLog(); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, MapLevel); DungeonMap = mapGenerator.CreateForrest(); DungeonMaps.Add(DungeonMap); _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); CommandSystem = new CommandSystem(); TargetingSystem = new TargetingSystem(); InputSystem = new InputSystemPlaying(); InventoryScreen = new InventoryScreen(_popupWidth, _popupHeight); DialogScreen = new DialogScreen(_popupWidth, _dialogHeight); ShopSelectionScreen = new ShopSelectionScreen(_popupWidth, _dialogHeight); BuyScreen = new BuyScreen(_popupWidth, _popupHeight); SellScreen = new SellScreen(_popupWidth, _popupHeight); if (Player.GreetMessages != null) { Random random = new Random(); int i = random.Next(0, Player.GreetMessages.Length); MessageLog.Add($"{Player.GreetMessages[i]}", Colors.Gold); } else { MessageLog.Add("Good luck on your quest ", Colors.Gold); } // MessageLog.Add($"Level created with seed '{seed}'"); // debug _rootConsole.Update += OnIntroUpdate; _rootConsole.Render += OnIntroRender; Timer t = new Timer(UpdateColoredText, null, 0, 200); _rootConsole.Run(); }
public static void Main() { // This must be the exact name of the bitmap font file we are using or it will error. string fontFileName = "terminal8x8.png"; // The title will appear at the top of the console window string consoleTitle = "Hunter v0.0"; // Tell RLNet to use the bitmap font that we specified and that each tile is 8 x 8 pixels _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); // Initialize the sub consoles that we will Blit to the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); Player = new Player(); CommandSystem = new CommandSystem(); QuestMenu = new QuestMenu(_menuWidth, _menuHeight); DeathScreen = new DeathScreen(_menuWidth, _menuHeight); WinMenu = new WinMenu(_menuWidth, _menuHeight); Menu = new Menu(_menuWidth, _menuHeight); SchedulingSystem = new SchedulingSystem(); // Create a new MessageLog and print the random seed used to generate the level MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add("Prepare to fight for your life"); //Generate the map TownMap mapCreation = new TownMap(_mapWidth, _mapHeight); //SimpleBsp mapCreation = new SimpleBsp(_mapWidth, _mapHeight); //FullRoomBsp mapCreation = new FullRoomBsp(_mapWidth, _mapHeight); DungeonMap = mapCreation.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); // Set up a handler for RLNET's Update event _rootConsole.Update += OnRootConsoleUpdate; // Set up a handler for RLNET's Render event _rootConsole.Render += OnRootConsoleRender; // Begin RLNET's game loop _rootConsole.Run(); }
public Game(GameManager manager, int seed) { this.Manager = manager; Random = new DotNetRandom(seed); commandSystem = new CommandSystem(this); MessageLog = new MessageLog(this); SchedulingSystem = new SchedulingSystem(); MessageLog.Add("You have entered Level " + (GameData.Data.CurrentLevel + 1)); if (GameData.Data.CurrentLevel == GameData.Data.Levels - 1) { MessageLog.Add("You sense an ominous presence."); } }
public static void Main() { //establish the seed for the random number generator from the current time int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); // the title will appear on top of the console window and include the seed used to generate the level string consoleTitle = $"RogueSharp V4 - Level {_mapLevel} - Seed {seed}"; //must be the exact name of the bitmap file or we will get an error string fontFileName = "terminal8x8.png"; //tell RLNet to use the bitmap font we specified, and that each tile is 8x8 pixels. _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); //initialize the sub-consoles that we will Blit to the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); CommandSystem = new CommandSystem(); //set up a handler for RLNET's update event _rootConsole.Update += OnRootConsoleUpdate; //set up a handler for RLNET's Render event _rootConsole.Render += OnRootConsoleRender; //Create a new MessageLog and print the random seed used to generate the level MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on Level 1."); MessageLog.Add($"Level was created with seed '{seed}'"); //Commented out below is just how to set the background color for the inventory console (can also be used for the messagelog or stats console, as well) //_inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, RLColor.Cyan) //begin RLNET's game loop _rootConsole.Run(); }
private void Start() { schedule = FindObjects.GameLogic.GetComponent <SchedulingSystem>(); progress = FindObjects.GameLogic.GetComponent <DungeonProgress>(); progressData = FindObjects.GameLogic.GetComponent <DungeonProgressData>(); color = FindObjects.GameLogic.GetComponent <GameColor>(); modeline = FindObjects.GameLogic.GetComponent <UIModeline>(); message = FindObjects.GameLogic.GetComponent <UIMessage>(); actorData = FindObjects.GameLogic.GetComponent <ActorData>(); potionData = FindObjects.GameLogic.GetComponent <PotionData>(); coord = FindObjects.GameLogic.GetComponent <ConvertCoordinates>(); fungus = FindObjects.GameLogic.GetComponent <NourishFungus>(); text = FindObjects.GameLogic.GetComponent <GameText>(); getActor = FindObjects.GetStaticActor; }
public static void Main() { //Establish the seed for the random number generator from the current time int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); //Title will appear at the top of the console window and will include the seed for the level string consoleTitle = $"RPG_Game - Level {_mapLevel} - Seed {seed}"; SchedulingSystem = new SchedulingSystem(); CommandSystem = new CommandSystem(); string fontFileName = "terminal8x8.png"; //Tells RLNet to use the bitmap font and that each tile is 8x8 pixels _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); // Initialize the sub consoles that we will Blit to the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); _rootConsole.Update += OnRootConsoleUpdate; _rootConsole.Render += OnRootConsoleRender; //Set background color and text color for each console MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add($"Level created with seed '{seed}'"); _statConsole.SetBackColor(0, 0, _statWidth, _statHeight, Swatch.DbOldStone); _statConsole.Print(1, 1, "Stats", Colors.TextHeading); _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Swatch.DbWood); _inventoryConsole.Print(1, 1, "Inventory", Colors.TextHeading); _rootConsole.Run(); }
public static void Main(string[] args) { //establish seed from random number generator from current time int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); // This must be the exact name of the bitmap font file we are using or it will error. string fontFileName = "terminal8x8.png"; //include title at top of console window string consoleTitle = $"Rougelike - Level {_mapLevel} - Seed {seed}"; SchedulingSystem = new SchedulingSystem(); // Tell RLNet to use the bitmap font that we specified and that each tile is 8 x 8 pixels _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); //initialize all the sub consoles that blit onto the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight); CommandSystem = new CommandSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); //create new MessageLog and print the random seed used to generate level MessageLog = new MessageLog(); MessageLog.Add("The player arrives on level 1"); MessageLog.Add($"Level created with seed '{seed}'"); // Set up a handler for RLNET's Update event _rootConsole.Update += OnRootConsoleUpdate; // Set up a handler for RLNET's Render event _rootConsole.Render += OnRootConsoleRender; // Begin RLNET's game loop _rootConsole.Run(); }
private static void Check() { if (Levels.Count != 0) { messageConsole.Clear(); inventoryConsole.Clear(); statConsole.Clear(); CommandSystem.PlayerIsDead = false; CommandSystem.IsGameEnded = false; Player = null; Levels.Clear(); SchedulingSystems.Clear(); CurrentLevel = null; CurrentSchedulingSystem = null; DungeonMap = null; SchedulingSystem = new SchedulingSystem(); MessageLog.Clear(); } }
public static void Main(string[] args) { string fontFileName = "terminal8x8.png"; int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); string consoleTitle = $"RogueLike Test - Level {_mapLevel} - Seed {seed}"; CommandSystem = new CommandSystem(); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); _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); _mapConsole.SetBackColor(0, 0, _mapWidth, _mapHeight, Colors.FloorBackground); _mapConsole.Print(1, 1, "Mapa", Colors.TextHeading); MessageLog = new MessageLog(); MessageLog.Add("O Errante chega no andar 1"); MessageLog.Add($"Level criado com a seed '{seed}'"); _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Swatch.DbWood); _inventoryConsole.Print(1, 1, "Inventario", Colors.TextHeading); _rootConsole.Update += OnRootConsoleUpdate; _rootConsole.Render += OnRootConsoleRender; _rootConsole.Run(); }
public static void Main() { StartServer(); LastPlayed(); // Establish the seed for the random number generator from the current time int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); // The title will appear at the top of the console window // also include the seed used to generate the level string consoleTitle = $"RogueSharp - Level {_mapLevel} - Seed {seed}";; // Create a new MessageLog and print the random seed used to generate the level MessageLog = new MessageLog(); MessageLog.Add($"The rogue arrives on level '{_mapLevel}'"); MessageLog.Add($"Level created with seed '{seed}'"); CommandSystem = new CommandSystem(); SchedulingSystem = new SchedulingSystem(); // This must be the exact name of the bitmap font file we are using or it will error. string fontFileName = "terminal8x8.png"; // Tell RLNet to use the bitmap font that we specified and that each tile is 8 x 8 pixels _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); // Set up a handler for RLNET's Update event _rootConsole.Update += OnRootConsoleUpdate; // Set up a handler for RLNET's Render event _rootConsole.Render += OnRootConsoleRender; // Begin RLNET's game loop MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 15, 8, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); _rootConsole.Run(); }
public Game(UI_Main console) { int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); commandSystem = new CommandSystem(this); MessageLog = new MessageLog(this); SchedulingSystem = new SchedulingSystem(); rootConsole = console; rootConsole.UpdateView += OnUpdate; // Set up a handler for graphic engine Update event MessageLog.Add("The rogue arrives on level " + mapLevel); MessageLog.Add("Level created with seed '" + seed + "'"); GenerateMap(); rootConsole.SetPlayer(Player); World.UpdatePlayerFieldOfView(Player); Draw(); }
IEnumerator Start() { while (!Display.IsInitialized()) { yield return(null); } GameObject.Find("Main Camera").GetComponent <Camera>().orthographicSize = 41; int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); text = GameObject.Find("massageText").GetComponent <Text>(); text.color = Color.white; MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add(string.Format("Level created with seed '{0}'", seed)); Player = new Player(); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); EquipmentItems = GameObject.Find("equipmentItems"); AbilitiesItems = GameObject.Find("abilitiesItems"); ItemItems = GameObject.Find("itemItems"); PlayerStat = GameObject.Find("playerStat"); MonsterStat = GameObject.Find("monsterStat"); MonsterItem = Resources.Load <GameObject>("Prefabs/monsterItem"); CommandSystem = new CommandSystem(); TargetingSystem = new TargetingSystem(); Player.Item1 = new RevealMapScroll(); Player.Item2 = new RevealMapScroll(); StartCoroutine(OnRootConsoleUpdate()); StartCoroutine(OnRootConsoleRender()); }
public static void Main() { MessageLog = new MessageLog(); CommandSystem = new CommandSystem(); SchedulingSystem = new SchedulingSystem(); int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); MessageLog.Add($"Level created with seed {seed}"); //this must be the exact name of the bitmap font file we are using var fontFileName = "terminal8x8.png"; //this title will appear at the top of the console window var consoleTitle = "Roguesharp Tutorial - Level 1 - Seed {seed}"; _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7); DungeonMap = mapGenerator.CreateMap(); DungeonMap.updatePlayerFieldOfView(); MessageLog.Add($"Map generated and player added"); // Initialize the sub consoles that we will Blit to the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight); //set up a handler for the update event _rootConsole.Update += OnRootConsoleUpdate; _rootConsole.Render += OnRootConsoleRender; _currentState = _gameStates.MainMenu; renderRequired = true; _rootConsole.Run(); }
static void Main(string[] args) { int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); string fontFileName = "terminal8x8.png"; string consoleTitle = $"RogueSharp - Level 1 - Seed: {seed}"; _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); SchedulingSystem = new SchedulingSystem(); //Player = new Player(); MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); CommandSystem = new CommandSystem(); MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives at level 1"); MessageLog.Add($"Dungeon generated with seed: {seed}"); // Only Run This Block Once... For now _inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Swatch.DbWood); _inventoryConsole.Print(1, 1, "Inventory", Colors.TextHeading); // Resume regular operation _rootConsole.Update += OnRootConsoleUpdate; _rootConsole.Render += OnRootConsoleRender; _rootConsole.Run(); }
private static void Init() { //Inst the EntityManager EntityManager = new EntityManager(); //Inst the CommandManager CommandManager = new CommandManager(); //Inst the UI manager UIManager = new UIManager(); //Inst the Scheduling System SchedulingSystem = new SchedulingSystem(); //Inst the World World = new World(); //Pop the splash screen //UIManager.Splash(); //Init the UIManager UIManager.Init(); }
private static void InitializeGame() { if (playWithSeed) { _seed = _save.Seeds[_mapLevel - 1]; } else { // Establish the seed for the random number generator from the current time _seed = (int)DateTime.UtcNow.Ticks; _save = new Save(); _save.Seeds.Add(_seed); } Random = new DotNetRandom(_seed); DisplayAsync(); _rootConsole.Title = $"RogueSharp RLNet Tutorial - Level {_mapLevel} - Seed {_seed}"; CommandSystem = new CommandSystem(); SchedulingSystem = new SchedulingSystem(); Inventory = new Inventory(); MapGenerator mapGenerator = ChoseMapGenerator(); Map = mapGenerator.CreateMap(_seed); MessageLog = new MessageLog(_messageHeight - 2); MessageLog.Add($"{Player.Name} arrive au niveau {_mapLevel}"); MessageLog.Add($"Niveau creer avec la seed '{_seed}'"); Map.UpdatePlayerFieldOfView(); Player.Reset(); _gameOver = false; MessageLog.Add(Story.levelBeginnigTexts[_mapLevel - 1]); }
public static void Main(string[] args) { // Establece la semilla desde un número random obtenido desde el tiempo actual. int seed = (int)DateTime.UtcNow.Ticks; Random = new DotNetRandom(seed); string fontFileName = "terminal8x8.png"; string consoleTitle = $"OmniSharp - Level {_mapLevel} - Seed {seed}"; rootConsole = new RLRootConsole(fontFileName, screenWidth, screenHeight, 8, 8, 1f, consoleTitle); MessageLog = new MessageLog(); MessageLog.Add("El Rogue ha llegado al nivel 1"); MessageLog.Add($"Mazmorra generada con la semilla '{seed}'"); mazmorraConsole = new RLConsole(mazmorraWidth, mazmorraHeight); mensajeConsole = new RLConsole(mensajeWidth, mensajeHeight); estadisticaConsole = new RLConsole(estadisticasWidth, estadisticasHeight); inventarioConsole = new RLConsole(inventarioWidth, inventarioHeight); SchedulingSystem = new SchedulingSystem(); MapGenerator mapGenerator = new MapGenerator(mazmorraWidth, mazmorraHeight, 20, 13, 7, _mapLevel); DungeonMap = mapGenerator.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); CommandSystem = new CommandSystem(); rootConsole.Render += RootConsole_Render; rootConsole.Update += RootConsole_Update; rootConsole.Run(); }
/// <summary> /// Initializes the subconsoles for the overworld, creates /// the overworld, starts some necessary Systems, then displays /// an initial message to the console. /// </summary> private void StartGame() { // Initialize the sub consoles that we will Blit to the root console // Note: mapConsole needs to be as big as the world, but we'll only render a section of it mapConsole = new RLConsole(Dimensions.WorldWidth, Dimensions.WorldHeight); messageConsole = new RLConsole(Dimensions.MessageWidth, Dimensions.MessageHeight); statConsole = new RLConsole(Dimensions.StatWidth, Dimensions.StatHeight); inventoryConsole = new RLConsole(Dimensions.InventoryWidth, Dimensions.InventoryHeight); // Create our command system CommandSystem = new CommandSystem(); // Start our scheduling system SchedulingSystem = new SchedulingSystem(); // Now that Random is initialized w/ seed... create the random based variables maxRooms = Random.Next(10, 15); maxRoomWidth = Random.Next(13, 22); maxRoomHeight = Random.Next(8, 11); // Add the first DungeonMap to the list: the overworld. DungeonMap = new MapGenerator( Dimensions.WorldWidth, Dimensions.WorldHeight, maxRooms, maxRoomWidth, maxRoomHeight, _mapLevel ).CreateWorld(); // Now that we have player AND map, we can update player FOV DungeonMap.UpdatePlayerFieldOfView(); DungeonMaps.Add(DungeonMap); // Now make our overworld listen to our custom functions console.Update += OnOverworldUpdate; console.Render += OnOverworldRender; // Create a new MessageLog and print the random seed used to generate the level MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives in the lush forests of Agnoth."); MessageLog.Add($"Level created with seed '{seed}'."); }