Esempio n. 1
0
 public void Insert(TerrainTile Tile)
 {
     GroundTiles.Add(Tile);
 }
Esempio n. 2
0
 public static MongoDB.Document TileToDocument(TerrainTile Tile)
 {
     var Doc = new MongoDB.Document();
     Doc["x"] = Tile.X;
     Doc["y"] = Tile.Y;
     Doc["tile_type"] = (int)Tile.TileID;
     return Doc;
 }
Esempio n. 3
0
 public void BroadcastTileUpdate(TerrainTile T)
 {
     NetOutgoingMessage Message = NetworkManager.Server.CreateMessage();
     Message.Write((byte)MessageTypes.MapDataChange);
     Message.Write(1);
     Message.Write(T.X);
     Message.Write(T.Y);
     Message.Write(T.Passable);
     NetworkManager.Server.SendToAll(Message, NetDeliveryMethod.ReliableOrdered);
 }
Esempio n. 4
0
 public void SetTile(int X, int Y, TerrainTile T)
 {
     TerrainTile Tile = (from t in Terrain where t.X == X && t.Y == Y select t).Single();
     if (Tile != null)
     {
         int Index = Terrain.IndexOf(Tile);
         Terrain[Index] = T;
     }
     else {
         Terrain.Add(Tile);
     }
     BroadcastTileUpdate(T);
     Console.WriteLine("Synced Terrain Update to ALL");
 }
Esempio n. 5
0
        public void UpdateTerrainTiles(NetIncomingMessage MapData)
        {
            int TerrainCount = MapData.ReadInt32();
            for (int i = 0; i < TerrainCount; i++)
            {
                var Terr = new TerrainTile()
                {
                    X = MapData.ReadInt32(),
                    Y = MapData.ReadInt32(),
                    TileID = MapData.ReadByte(),
                    Passable = MapData.ReadBoolean(),
                };

                var T = TileAt(Terr.X, Terr.Y);
                if (T != null)
                    Terrain[Terrain.IndexOf(T)] = Terr;
                else
                    Terrain.Add(Terr);
            }

            Console.WriteLine("Synced {0} Tiles with server", TerrainCount);
        }