Esempio n. 1
0
        public void CreateNewWorld(string playerName, string startingBackground)
        {
            // Don't use property so we don't hit validation code
            m_currentLevel = 0;

            Stairs incommingStairs = null;
            Random random = new Random();
            bool generateCave = false;
            for (int i = 0; i < 5; ++i)
            {
                generateCave = random.Chance(50);
                MapGeneratorBase mapGenerator = generateCave ? (MapGeneratorBase)new SimpleCaveGenerator(random) : (MapGeneratorBase)new StitchtogeatherMapGenerator(random);
                    
                m_dungeon[i] = mapGenerator.GenerateMap(incommingStairs, i);

                incommingStairs = m_dungeon[i].MapObjects.Where(x => x.Type == MapObjectType.StairsDown).OfType<Stairs>().First();              
            }
 
            Point initialStairsUpPosition = m_dungeon[0].MapObjects.Where(x => x.Type == MapObjectType.StairsUp).OfType<Stairs>().First().Position;

            ClearMonstersFromStartingArea(initialStairsUpPosition);

            m_player = new Player(playerName, initialStairsUpPosition);
            PlayerBackgrounds.SetupBackground(m_player, startingBackground);

            TurnCount = 0;

            m_physicsEngine = new PhysicsEngine(Player, Map);
            m_pathFinding = new PathfindingMap(Player, Map);

            // If the player isn't the first actor, let others go. See archtecture note in PublicGameEngine.
            m_physicsEngine.AfterPlayerAction(this);
        }
Esempio n. 2
0
        public void LoadSaveFile(string saveGameName)
        {
            string saveGameDirectory = GetSaveDirectoryCreateIfNotExist();
            m_saveLoad.LoadGame(Path.Combine(saveGameDirectory, saveGameName));

            m_physicsEngine = new PhysicsEngine(Player, Map);
            m_pathFinding = new PathfindingMap(Player, Map);
        }