Ejemplo n.º 1
0
        public void Update(AbstractHumanoid currentPlayer, RayTracer rayTracer, AbstractMap map, Surface surface)
        {
            int columnXLeftMargin = 0;

            for (int columnId = 0; columnId < columnCount; columnId++)
            {
                double straightDistance = Optics.GetStraightDistance(currentPlayer, rayTracer[columnId]);
                double columnHeight     = Optics.GetColumnHeight(straightDistance, screenHeight, heightDistanceRatio);
                double topMargin        = Optics.GetColumnTopMargin(screenHeight, columnHeight, currentPlayer.PositionZ, currentPlayer.IsCrouch, currentPlayer.MouseLook);

                Rectangle rectangle = rectangleCache[columnId];
                rectangle.X      = columnXLeftMargin;
                rectangle.Y      = (int)topMargin;
                rectangle.Height = (int)columnHeight;

                columnXLeftMargin += columnWidthPixel;

                double brightness = Optics.GetBrightness(Math.Min(screenHeight, columnHeight), screenHeight);

                double red, green, blue;

                map.GetColors(rayTracer[columnId].X, rayTracer[columnId].Y, brightness, out red, out green, out blue);

                if (echolocationCycle.IsHighlightedColumn(columnId))
                {
                    red   = Math.Max(0, Math.Min(255, 256 - red));
                    green = Math.Max(0, Math.Min(255, 256 - green));
                    blue  = Math.Max(0, Math.Min(255, 256 - blue));

                    this.echolocationBeeper.Beep(straightDistance, columnId, columnCount);
                }

                surface.Fill(rectangle, Color.FromArgb(255, (byte)(red), (byte)(green), (byte)(blue)));
            }
        }
Ejemplo n.º 2
0
        public void SortByDistance(AbstractSprite referenceSprite)
        {
            foreach (AbstractSprite sprite in internalList)
            {
                sprite.DistanceToReferenceSprite = Optics.GetStraightDistance(referenceSprite, sprite);
            }

            internalList.Sort();
        }