Exemplo n.º 1
0
        public Bounds CalculateBounds(MyRectangle ring1NodePosition)
        {
            MyRectangle inGamePosition =
                _globalObjectPositionCalculator.CalculateGlobalObjectPosition(ring1NodePosition);

            return(new Bounds(
                       new Vector3(inGamePosition.X + inGamePosition.Width / 2, 0,
                                   inGamePosition.Y + inGamePosition.Width / 2),
                       new Vector3(inGamePosition.Width, 10, inGamePosition.Height)
                       ));
        }
Exemplo n.º 2
0
        private bool IsPreciseEnough(Ring1Node node)
        {
            Vector2 center          = _coordsCalculator.CalculateGlobalObjectPosition(node.Ring1Position).Center;
            float   currentDistance = Vector2.Distance(Utils.VectorUtils.To2DPosition(_cameraPosition),
                                                       center);

            int minLod            = _precisionDistances.Values.Max();
            int appropiateQuadLod =
                _precisionDistances.OrderByDescending(a => a.Key)
                .Where(c => c.Key < currentDistance)
                .Select(c => c.Value)
                .DefaultIfEmpty(minLod)
                .First();
            var isPreciseEnough = node.QuadLodLevel >= appropiateQuadLod;

            //Debug.Log($"E1: Cen:{_cameraPosition} Test center:{center}, lod {node.QuadLodLevel} distance{currentDistance}, appropiate: {appropiateQuadLod}, isOk, {isPreciseEnough}");

            return(isPreciseEnough);
        }