private void RefreshDepth() { int depth = GetDepthAvailable(gameObject, out bool waterFound); if (depth != previousDepth || waterFound != previousWaterFound) { if (depth <= 0) { line.SetVisiblity(false); hook?.SetVisiblity(false); } else { line.SetVisiblity(true); line.Play(lineAnim + depth, playMode); hook?.SetVisiblity(true); } if (type != GuideType.Preview) { // todo: пока выключил резервацию тайлов. тк создает неопределенное поведение, // если сделать работу в разных типах комнатах для совместимости с "роом эхпандед" // надо подумать #if false OccupyArea(depth); #endif if (kSelectable != null) { kSelectable.ToggleStatusItem(statusItemNoDepth, depth <= 0); kSelectable.ToggleStatusItem(statusItemNoWater, depth > 0 && !waterFound); } } previousDepth = depth; previousWaterFound = waterFound; } }
private void UpdateVisibility() { if (DoGridProcessing()) { GetVisibleCellRange(out Vector2I min, out Vector2I max); vis_chunk_min = new Vector2I(min.x / 32, min.y / 32); vis_chunk_max = new Vector2I(max.x / 32, max.y / 32); vis_chunk_max.x = Math.Min(vis_chunk_max.x, controllerGrid.GetLength(0) - 1); vis_chunk_max.y = Math.Min(vis_chunk_max.y, controllerGrid.GetLength(1) - 1); bool[,] array = previouslyVisibleChunkGrid; previouslyVisibleChunkGrid = visibleChunkGrid; visibleChunkGrid = array; Array.Clear(visibleChunkGrid, 0, visibleChunkGrid.Length); List <Vector2I> list = previouslyVisibleChunks; previouslyVisibleChunks = visibleChunks; visibleChunks = list; visibleChunks.Clear(); for (int i = vis_chunk_min.y; i <= vis_chunk_max.y; i++) { for (int j = vis_chunk_min.x; j <= vis_chunk_max.x; j++) { visibleChunkGrid[j, i] = true; visibleChunks.Add(new Vector2I(j, i)); if (!previouslyVisibleChunkGrid[j, i]) { List <KBatchedAnimController> list2 = controllerGrid[j, i]; for (int k = 0; k < list2.Count; k++) { KBatchedAnimController kBatchedAnimController = list2[k]; if (!((UnityEngine.Object)kBatchedAnimController == (UnityEngine.Object)null)) { kBatchedAnimController.SetVisiblity(true); } } } } } for (int l = 0; l < previouslyVisibleChunks.Count; l++) { Vector2I vector2I = previouslyVisibleChunks[l]; if (!visibleChunkGrid[vector2I.x, vector2I.y]) { List <KBatchedAnimController> list3 = controllerGrid[vector2I.x, vector2I.y]; for (int m = 0; m < list3.Count; m++) { KBatchedAnimController kBatchedAnimController2 = list3[m]; if (!((UnityEngine.Object)kBatchedAnimController2 == (UnityEngine.Object)null)) { kBatchedAnimController2.SetVisiblity(false); } } } } } }