Ejemplo n.º 1
0
        public static GameWorld LoadWorld(List <string> lines, WorldType type)
        {
            var world = new GameWorld(type);

            for (var i = 0; i < lines.Count; i++)
            {
                for (int s = 0; s < lines[i].Length; s++)
                {
                    char c         = lines[i][s];
                    var  newObject = GetGameObject(s, i, c);
                    if (newObject == null)
                    {
                        continue;
                    }
                    if (newObject is Player)
                    {
                        world.AddGamePlayer(newObject as Player);
                    }
                    else if (newObject.IsStatic || newObject is Teleport)
                    {
                        world.AddGameObject(newObject, 1);
                    }
                    else
                    {
                        world.AddGameObject(newObject);
                    }
                }
            }
            return(world);
        }
Ejemplo n.º 2
0
        public void SwitchWorlds()
        {
            shadowWorld.SwitchWorldType();
            mainWorld.SwitchWorldType();
            var player = mainWorld.player;

            mainWorld.RemoveGamePlayer(player);
            shadowWorld.AddGamePlayer(player);
            var tmp = mainWorld;

            mainWorld   = shadowWorld;
            shadowWorld = tmp;
        }