public GetObjectVisibility ( |
||
ob | ||
Результат | ObjectVisibility |
void SendNewObjects(IEnumerable <MovableObject> revealedObjects) { foreach (var ob in revealedObjects) { var vis = m_player.GetObjectVisibility(ob); Debug.Assert(vis != ObjectVisibility.None); ob.SendTo(m_player, vis); } }
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); } }