public override void Draw(SpriteBatch spriteBatch) { _graphicsDevice.Clear(Color.Black); spriteBatch.Begin(transformMatrix: _camera.ViewMatrix); _mapManager.DrawMap(spriteBatch); _scoreDisplayer.Draw(spriteBatch, _mapManager); spriteBatch.End(); }
public DungeonFloor AdvanceFloor() { if (Level + 1 >= Floors.Count) { GenerateFloor(); } Level++; var currentFloor = GetCurrentFloor(); currentFloor.DrawRoomAtCoord(new Vector2Int(0, 0)); MapManager.DrawMap(currentFloor); return(currentFloor); }
void Start() { _ = _heightmap ?? throw new ArgumentNullException("Heightmap for map generation has not been set! Set one in the GameManager script"); var base_map = _mapManager.FromHeightmap(_heightmap, _tileSet, 5); _mapManager.DrawMap(base_map); var bounds = base_map.GetBoundaries(); if (AllowCameraAngleToInfluenceBoundaries) { bounds.OffsetBoundaries(cameraManager.CalculateOffsetFromCameraAngle()); } cameraManager.cameraBoundaries = bounds; InvokeRepeating("TickEconomy", 0, tickIntervalInSeconds); }
static void Main(string[] args) { //////////////////////////////////// // Used to prevent console resize // //////////////////////////////////// IntPtr handle = GetConsoleWindow(); IntPtr sysMenu = GetSystemMenu(handle, false); if (handle != IntPtr.Zero) { DeleteMenu(sysMenu, SC_CLOSE, MF_BYCOMMAND); DeleteMenu(sysMenu, SC_MINIMIZE, MF_BYCOMMAND); DeleteMenu(sysMenu, SC_MAXIMIZE, MF_BYCOMMAND); DeleteMenu(sysMenu, SC_SIZE, MF_BYCOMMAND); } //////////////////////////////////// //Create the new player _player = Player.CreateNewPlayer(); _player.EquippedWeapon = World.Weapons[1]; foreach (var item in World.Spells) { _player.KnownSpells.Add(item); } //Bools bool _gameOver = false; //Enum State value = State.Exploration; //////////////////////////////////// _player.CharacterCreation(); Console.Clear(); Console.CursorVisible = false; UI.Initialize(); UI.DrawGUI(_player); UI.DrawGameScreen(); UI.DrawPlayer(_player); MapManager.DrawMap(); do { if (value == State.Exploration) { UI.DrawGUI(_player); value = ParseCommand(); } else if (value == State.Battle) { Monster _currentMonster = new Monster(standardMonster.Name, standardMonster.Damage, standardMonster.MaxHP, standardMonster.ExperiencePointsValue, standardMonster.GoldValue); Console.Clear(); UI.DrawBattleScreen(); UI.DrawGUI(_player); Entity dead = NewBattle.StartBattle(_currentMonster, _player); if (dead == _currentMonster) { value = State.Exploration; Console.Clear(); UI.DrawGameScreen(); MapManager.DrawMap(); UI.DrawPlayer(_player); } else { UI.WriteToInfoArea("You are dead. GAME OVER"); _gameOver = true; } } } while (!_gameOver); Console.WriteLine("It seems that you have been killed"); Console.ReadKey(); }
void Update() { if (canMove) { if (Input.GetAxisRaw("Vertical") == 1) { if (mapManager.map[xPos, yPos].w == 1) { yPos++; canMove = false; exitedShop = false; } } if (Input.GetAxisRaw("Vertical") == -1) { if (mapManager.map[xPos, yPos].y == 4) { yPos--; canMove = false; exitedShop = false; } } if (Input.GetAxisRaw("Horizontal") == -1) { if (mapManager.map[xPos, yPos].z == 8) { xPos--; canMove = false; exitedShop = false; } } if (Input.GetAxisRaw("Horizontal") == 1) { if (mapManager.map[xPos, yPos].x == 2) { xPos++; canMove = false; exitedShop = false; } } this.gameObject.transform.position = new Vector3Int(xPos - 2, yPos - 2, 0); mapManager.visibility[xPos, yPos] = 1; mapManager.DrawMap(); if (Input.GetKey(KeyCode.Backspace)) { canMove = true; exitedShop = true; return; // dev tool to skip encounters } if (mapManager.roomTypes[xPos, yPos] == 0) { keepMoving = true; } else if (mapManager.roomTypes[xPos, yPos] == 1) { mapManager.encounters[xPos, yPos].SetActive(true); SceneManager.LoadScene("Battle"); } else if (mapManager.roomTypes[xPos, yPos] == 2 && !exitedShop) { mapManager.encounters[xPos, yPos].SetActive(true); SceneManager.LoadScene("Shop"); } else if (mapManager.roomTypes[xPos, yPos] == 3) { mapManager.encounters[xPos, yPos].SetActive(true); SceneManager.LoadScene("Treasure"); } else if (mapManager.roomTypes[xPos, yPos] == 4) { mapManager.encounters[xPos, yPos].SetActive(true); mapManager.encounters[xPos, yPos].GetComponent <Encounter>().LoadEvent(); } else if (mapManager.roomTypes[xPos, yPos] == 5) //boss { mapManager.encounters[xPos, yPos].SetActive(true); SceneManager.LoadScene("Battle"); //SceneManager.LoadScene("NewCharacter"); //GameObject party = GameObject.Find("PlayerParty"); //party.GetComponent<PartyManager>().ChooseNewCharacter(); //GameObject.Find("GameManager").GetComponent<Game>().CreateLevel(); } } //mapManager.playerPos = new Vector2(xPos, yPos); //wait for key up if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0 && keepMoving) { canMove = true; keepMoving = false; } }