private void RefreshOctant2(Vector2 _originPosition, int _octant) { ShadowLine line = new ShadowLine(); bool fullShadow = false; for (int row = 1; row < km_maxDistance; row++) { for (int col = 0; col <= row; col++) { Vector2 position = _originPosition + ConvertPositionToOctantPosition(row, col, _octant); DungeonTile CurrentTile = DungeonManager.instance.GetTileOnPosition(position.x, position.y); if (CurrentTile == null) { continue; } if (fullShadow) { CurrentTile.IsVisible = false; } else { Shadow projection = ProjectTile(row, col); // Setting Visibility of this tile... bool visible = !line.IsInShadow(projection); CurrentTile.IsVisible = visible; if (visible) { CurrentTile.WasTileDiscovered = true; } if (visible && (CurrentTile.IsWall || CurrentTile.BlockVision)) { line.AddShadowToLine(projection); fullShadow = line.IsFullShadow; } } CurrentTile.UpdateTile(); } } }
/// <summary> /// Check if a shadow is completely covered by this shadow /// </summary> /// <param name="_other">Shadow tile to be checked</param> /// <returns>True if _other if completely covered by this shadow, false otherwise.</returns> public bool ContainsOther(Shadow _other) { return(start <= _other.start && end >= _other.end); }