public WorldPointContinent ContinentPointToWorldPoint(ContinentPoint point, ContinentSimulation Sim)
        {
            Vector2 mod    = Vector2.zero;
            Vector2 newPos = point.Pos + WorldPointCenter.Pos;

            if (newPos.x > Sim.Width - 1)
            {
                mod = new Vector2(-Sim.Width, 0);
            }
            if (newPos.x > Sim.Width * 2 - 1)
            {
                mod = new Vector2(-Sim.Width * 2, 0);
            }
            if (newPos.x < 0)
            {
                mod = new Vector2(Sim.Width, 0);
            }
            if (newPos.x < -Sim.Width)
            {
                mod = new Vector2(Sim.Width * 2, 0);
            }
            if (newPos.y >= 100)
            {
                return(null);
            }
            if (newPos.y < 0)
            {
                return(null);
            }
            if (!Sim.WorldPointContinents.ContainsKey(newPos + mod))
            {
                Debug.Log("Bad Vector: " + (point.Pos + WorldPointCenter.Pos + mod) + " points: " + point.Pos + WorldPointCenter.Pos + mod);
            }
            return(Sim.WorldPointContinents[point.Pos + WorldPointCenter.Pos + mod]);
        }
 public void RecalculateEdges(ContinentSimulation Sim)
 {
     foreach (ContinentPoint point in Points.Values)
     {
         List <ContinentPoint> neighbors  = GetNeighbors(point);
         WorldPointContinent   worldPoint = ContinentPointToWorldPoint(point, Sim);
         if (worldPoint == null)
         {
             continue;
         }
         if (neighbors.Count == 8)
         {
             point.Edge = false;
         }
         //check if edge
         if (worldPoint.Pos.x == 0 && worldPoint.Pos.y == 0)
         {
             if (neighbors.Count() == 3)
             {
                 point.Edge = false;
             }
         }
         else if (worldPoint.Pos.x == 0 || worldPoint.Pos.y == 0)
         {
             if (neighbors.Count() == 5)
             {
                 point.Edge = false;
             }
         }
     }
 }