示例#1
0
 public Instance(Player owner, Area area, int indexStart, int indexEnd)
 {
     Owner = owner;
     Area = area;
     IndexStart = indexStart;
     IndexEnd = indexEnd;
 }
示例#2
0
        public Area Generate()
        {
            Area area = new Area();
            int indexNumber;
            Room prevRoom = null;
            Room room = null;
            Exit exit;
            int i = 0;
            int x = 500;
            int y = 500;
            int dir = -1;
            int prevDir = -1;
            Directions[] dirNormal = new Directions[] { Directions.North, Directions.South, Directions.West, Directions.East };
            Directions[] dirOpposite = new Directions[] { Directions.South, Directions.North, Directions.East, Directions.West };
            Random rand = new Random();

            while (i < IndexNumbers.Count)
            {
                indexNumber = IndexNumbers[i];

                room = new Room(indexNumber);
                area.Rooms.Add(room);
                Coordinates[x, y] = indexNumber;

                if (prevRoom != null)
                {
                    while (true)
                    {
                        dir = rand.Next(0, 3);

                        if (dir != -1 && prevDir != -1 && dirNormal[dir] == dirOpposite[prevDir])
                            continue;

                        room.Exits[dirNormal[dir]] = new Exit(indexNumber, prevRoom.IndexNumber);
                        prevRoom.Exits[dirOpposite[dir]] = new Exit(prevRoom.IndexNumber, indexNumber);
                        break;
                    }

                    Global.Log("Created " + prevRoom.IndexNumber + " to " + indexNumber + " (" + dir.ToString() + ")");
                }

                prevDir = dir;
                prevRoom = room;
                i++;
            }

            return area;
        }
示例#3
0
        public Server(Main application)
        {
            Application = application;
            Global.Server = this;

            Global.Log("Booting up PolaMUD!\n\r");

            Global.Log("Loading terrain types... ");
            Global.TerrainTable.Add("Grass", new Terrain() { Name = "Grass" });
            Global.TerrainTable.Add("Forest", new Terrain() { Name = "Forest" });
            Global.TerrainTable.Add("Desert", new Terrain() { Name = "Desert" });
            RoomStyles.Generate();
            Global.Log("done!\n");

            Global.Log("Loading skills... ");
            List<Type> types = Assembly.GetCallingAssembly().GetTypes().Where(type => type.IsSubclassOf(typeof(Skill))).ToList();
            foreach (Type type in types)
            {
                if (type == typeof(Skill))
                    continue;
                Skill skill = (Skill)Activator.CreateInstance(type);
                Global.SkillTable.Add(skill.Name, skill);
                Global.Log(skill.Name + ", ");
            }
            Global.Log("done!\n");

            Global.Log("Loading areas...\n");
            Area area = new Area();
            area.Load("00_TestData\\limbo.xml");
            new Areas.TestArea();
            Global.Log("done!\n");

            Global.Log("Initializing game loop... ");
            Global.GameLoop = new GameLoop();
            Global.Log("done!\n");
        }
示例#4
0
        public bool CommandAload(Player user, Command command, string text)
        {
            text = Parser.GetStringArgument(text, 2).Text;

            Area area = new Area();
            area.Load(text);

            return true;
        }
示例#5
0
文件: Room.cs 项目: ramseur/PolaMUD
 /// <summary>
 /// Loads a new room from the provided XmlNode while automatically setting the area that the room belongs to.
 /// </summary>
 /// <param name="room"></param>
 /// <param name="area"></param>
 public void Load(XmlNode room, Area area)
 {
     Area = area;
     Load(room);
 }
示例#6
0
文件: Room.cs 项目: ramseur/PolaMUD
 /// <summary>
 /// Loads a new room from the provided XmlNode while automatically setting the area that the room belongs to.
 /// </summary>
 /// <param name="room"></param>
 /// <param name="area"></param>
 public void Load(XmlNode room, Area area)
 {
     Area = area;
     Load(room);
 }