Ejemplo n.º 1
0
        private void ContinueGame(object sender, EventArgs eventArgs)
        {
            WorldInstance overworld = WorldSerialiser.Deserialise("Everse");

            Done = true;

            WorldInstance playerWorld = overworld.Player.MyWorld;

            m_NextState = new WorldState(overworld, playerWorld, Gameplay.GameplayFlags.Moving);
        }
Ejemplo n.º 2
0
        public void LoadGame()
        {
            WorldSerialiser worldSerialiser = new WorldSerialiser(GlobalConstants.GameManager.ObjectIconHandler);
            IWorldInstance  overworld       = worldSerialiser.Deserialise("Everse");
            ICulture        playerCulture   = GlobalConstants.GameManager.EntityHandler.GetPlayer().Cultures.First();

            GlobalConstants.GameManager.GUIManager.CloseAllGUIs();
            GlobalConstants.GameManager.GUIManager.SetUIColours(
                playerCulture.BackgroundColours,
                playerCulture.CursorColours,
                playerCulture.FontColours);
            GlobalConstants.GameManager.SetNextState(new WorldInitialisationState(overworld, overworld.GetPlayerWorld(overworld)));
        }
Ejemplo n.º 3
0
        private void CreateWorld()
        {
            //Make a new overworld generator
            OverworldGenerator overworldGen = new OverworldGenerator(this.m_WorldInfoHandler);

            //Generate the basic overworld
            this.m_World = new WorldInstance(
                overworldGen.GenerateWorldSpace(WORLD_SIZE, "plains"),
                new string[] { "overworld", "exterior" },
                "Everse",
                GlobalConstants.GameManager.EntityHandler,
                GlobalConstants.GameManager.Roller);

            //Set the date and time for 1/1/1555, 12:00pm
            this.m_World.SetDateTime(new JoyDateTime(1555, 1, 1, 12));

            //Do the spawn point
            SpawnPointPlacer spawnPlacer = new SpawnPointPlacer(GlobalConstants.GameManager.Roller);
            Vector2Int       spawnPoint  = spawnPlacer.PlaceSpawnPoint(this.m_World);

            while ((spawnPoint.x == -1 && spawnPoint.y == -1))
            {
                spawnPoint = spawnPlacer.PlaceSpawnPoint(this.m_World);
            }

            this.m_World.SpawnPoint = spawnPoint;

            //Set up the player
            //m_Player.Move(m_World.SpawnPoint);
            //m_World.AddEntity(m_Player);

            //Begin the first floor of the Naga Pits
            WorldInfo worldInfo = this.m_WorldInfoHandler.GetRandom("interior");

            DungeonGenerator dungeonGenerator = new DungeonGenerator();
            WorldInstance    dungeon          = dungeonGenerator.GenerateDungeon(
                worldInfo,
                WORLD_SIZE,
                3,
                GlobalConstants.GameManager,
                GlobalConstants.GameManager.Roller);

            Vector2Int transitionPoint = spawnPlacer.PlaceTransitionPoint(this.m_World);

            this.m_World.AddArea(transitionPoint, dungeon);
            this.Done = true;

            this.m_ActiveWorld = dungeon;
            this.m_Player.Move(dungeon.SpawnPoint);
            dungeon.AddEntity(this.m_Player);

            GlobalConstants.GameManager.EntityHandler.Add(this.m_Player);

            IItemInstance lightSource = GlobalConstants.GameManager.ItemFactory.CreateRandomItemOfType(
                new string[] { "light source" },
                true);

            IItemInstance bag = GlobalConstants.GameManager.ItemFactory.CreateRandomItemOfType(
                new[] { "container" },
                true);

            IJoyAction addItemAction = this.m_Player.FetchAction("additemaction");

            addItemAction.Execute(
                new IJoyObject[] { this.m_Player, lightSource },
                new[] { "pickup" },
                new Dictionary <string, object>
            {
                { "newOwner", true }
            });

            addItemAction.Execute(
                new IJoyObject[] { this.m_Player, bag },
                new[] { "pickup" },
                new Dictionary <string, object>
            {
                { "newOwner", true }
            });

            for (int i = 0; i < 4; i++)
            {
                IItemInstance newItem = GlobalConstants.GameManager.ItemFactory.CreateRandomWeightedItem(
                    true,
                    false);
                addItemAction.Execute(
                    new IJoyObject[]
                {
                    this.m_Player,
                    newItem
                },
                    new[] { "pickup" },
                    new Dictionary <string, object>
                {
                    { "newOwner", true }
                });
            }

            this.m_World.Tick();

            GlobalConstants.GameManager.WorldHandler.Add(this.m_World);

            WorldSerialiser worldSerialiser = new WorldSerialiser(GlobalConstants.GameManager.ObjectIconHandler);

            worldSerialiser.Serialise(this.m_World);

            this.Done = true;
        }
Ejemplo n.º 4
0
        public override void _Ready()
        {
            base._Ready();

            this.WorldSerialiser = new WorldSerialiser(GlobalConstants.GameManager.ObjectIconHandler);
        }
Ejemplo n.º 5
0
 public override void Stop()
 {
     base.Stop();
     WorldSerialiser.Serialise(m_Overworld);
 }