Exemple #1
0
 public void UpdateVillage(Village v)
 {
     this.Entities.SaveChanges();
 }
Exemple #2
0
 public void AddVillage(Village v)
 {
     this.Entities.Village.AddObject(v);
     this.Entities.SaveChanges();
 }
Exemple #3
0
 public void DeleteVillage(Village v)
 {
     this.Entities.Village.DeleteObject(v);
     this.Entities.SaveChanges();
 }
Exemple #4
0
        private Map GenerateVillages(int amount, CommonLayer.Map map, int width, int height)
        {
            Random r = new Random();

            int _nameCounter = 65;

            for (int i = 0; i < amount; i++)
            {
                //Temp Values
                int _CurX = r.Next(width);
                int _CurY = r.Next(height);
                string name = "" + Convert.ToChar(_nameCounter);

                //Create new Village
                Village v = new Village();
                v.ID = Guid.NewGuid();
                v.Name = name;
                v.XCoor = _CurX;
                v.YCoor = _CurY;

                v.MapID = map.ID;

                //Add new Village to Map
                map.Village.Add(v);

                //Add plus one to the counter
                _nameCounter++;
            }

            return map;
        }
Exemple #5
0
 public IEnumerable<Road> GetVillageRoads(Village v)
 {
     return this.Entities.Road.Where(r => r.VillageFrom == v.ID);
 }
Exemple #6
0
 public Road GetRoadBetween(Village v, Village v2)
 {
     return this.Entities.Road.SingleOrDefault(r => r.VillageFrom == v.ID && r.VillageTo == v2.ID);
 }
Exemple #7
0
 /// <summary>
 /// Create a new Village object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="xCoor">Initial value of the XCoor property.</param>
 /// <param name="yCoor">Initial value of the YCoor property.</param>
 /// <param name="mapID">Initial value of the MapID property.</param>
 public static Village CreateVillage(global::System.Guid id, global::System.String name, global::System.Int32 xCoor, global::System.Int32 yCoor, global::System.Guid mapID)
 {
     Village village = new Village();
     village.ID = id;
     village.Name = name;
     village.XCoor = xCoor;
     village.YCoor = yCoor;
     village.MapID = mapID;
     return village;
 }
Exemple #8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Village EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVillage(Village village)
 {
     base.AddObject("Village", village);
 }