Exemplo n.º 1
0
 public void Update(Ring1Node ring1Node, Vector3 cameraPosition)
 {
     foreach (var listener in _terrains[ring1Node.Ring1Position])
     {
         listener.Update(ring1Node, cameraPosition);
     }
 }
Exemplo n.º 2
0
 public Ring1Root(Ring1Node downLeftNode, Ring1Node downRightNode, Ring1Node topRightNode, Ring1Node topLeftNode, IRing1NodeListener nodeListener)
 {
     _downLeftNode  = downLeftNode;
     _downRightNode = downRightNode;
     _topRightNode  = topRightNode;
     _topLeftNode   = topLeftNode;
     _nodeListener  = nodeListener;
 }
Exemplo n.º 3
0
 public void DoNotDisplay(Ring1Node ring1Node)
 {
     if (_terrains.ContainsKey(ring1Node.Ring1Position))
     {
         foreach (var listener in _terrains[ring1Node.Ring1Position])
         {
             listener.DoNotDisplay(ring1Node);
         }
     }
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 public void CreatedNewNode(Ring1Node ring1Node)
 {
     Preconditions.Assert(!_terrains.ContainsKey(ring1Node.Ring1Position),
                          "Terrain was not created for this node");
     _terrains[ring1Node.Ring1Position] = _newListenersCreator.Invoke(ring1Node);
 }
Exemplo n.º 6
0
 public bool IsTerminalNode(Ring1Node node)
 {
     return((IsMinimumLod(node.QuadLodLevel)) && (IsPreciseEnough(node) || IsMaximumLod(node.QuadLodLevel)));
 }