void SendNewTerrains(IEnumerable <IntVector3> revealedLocations) { if (revealedLocations.Any() == false) { return; } var msg = new Messages.MapDataTerrainsListMessage() { Environment = m_environment.ObjectID, TileDataList = revealedLocations.Select(l => new KeyValuePair <IntVector3, TileData>(l, m_environment.GetTileData(l))).ToArray(), }; m_player.Send(msg); }
void CheckVisibility(IntVector3 location, TileData oldData, TileData newData) { var env = m_environment; var initLocs = new IntVector3[] { location }; var target = new MyTarget(env, this); var bfs = new BFS(initLocs, target); var revealed = bfs.Find().ToList(); //Debug.Print("Revealed {0} tiles: {1}", revealed.Count, string.Join(", ", revealed.Select(p => p.ToString()))); if (revealed.Count == 0) { return; } foreach (var p in revealed) { SetVisible(p); } // Send new tiles var msg = new Messages.MapDataTerrainsListMessage() { Environment = env.ObjectID, TileDataList = revealed.Select(l => new KeyValuePair <IntVector3, TileData>(l, env.GetTileData(l))).ToArray(), }; m_player.Send(msg); // Send new objects foreach (var ob in revealed.SelectMany(env.GetContents)) { var vis = m_player.GetObjectVisibility(ob); Debug.Assert(vis != ObjectVisibility.None); ob.SendTo(m_player, vis); } }
protected void Send(ClientMessage msg) { m_player.Send(msg); }