示例#1
0
 public void RemoveGridMapReference(GridCoord p)
 {
     --GridMapReference[p.x_coord][p.y_coord];
     if (GridMapReference[p.x_coord][p.y_coord] == 0)
     {
         SetUnloadReferenceLock(new GridCoord(63 - p.x_coord, 63 - p.y_coord), false);
     }
 }
示例#2
0
        public float GetMinHeight(float x, float y)
        {
            if (_minHeightPlanes == null)
            {
                return(-500.0f);
            }

            GridCoord gridCoord = GridDefines.ComputeGridCoord(x, y);

            int doubleGridX = (int)(Math.Floor(-(x - MapConst.MapHalfSize) / MapConst.CenterGridOffset));
            int doubleGridY = (int)(Math.Floor(-(y - MapConst.MapHalfSize) / MapConst.CenterGridOffset));

            float gx = x - ((int)gridCoord.X_coord - MapConst.CenterGridId + 1) * MapConst.SizeofGrids;
            float gy = y - ((int)gridCoord.Y_coord - MapConst.CenterGridId + 1) * MapConst.SizeofGrids;

            uint quarterIndex = 0;

            if (Convert.ToBoolean(doubleGridY & 1))
            {
                if (Convert.ToBoolean(doubleGridX & 1))
                {
                    quarterIndex = 4 + (gx <= gy ? 1 : 0u);
                }
                else
                {
                    quarterIndex = (2 + ((-MapConst.SizeofGrids - gx) > gy ? 1u : 0));
                }
            }
            else if (Convert.ToBoolean(doubleGridX & 1))
            {
                quarterIndex = 6 + ((-MapConst.SizeofGrids - gx) <= gy ? 1u : 0);
            }
            else
            {
                quarterIndex = gx > gy ? 1u : 0;
            }


            Ray ray = new Ray(new Vector3(gx, gy, 0.0f), Vector3.ZAxis);

            return(ray.intersection(_minHeightPlanes[quarterIndex]).Z);
        }
示例#3
0
 public bool Equals(GridCoord other)
 {
     return(other.x_coord == x_coord && other.y_coord == y_coord);
 }
示例#4
0
 public GridCoord(GridCoord obj)
 {
     x_coord = obj.x_coord;
     y_coord = obj.y_coord;
 }
示例#5
0
 public bool Equals(GridCoord other)
 {
     return(other.X_coord == X_coord && other.Y_coord == Y_coord);
 }
示例#6
0
 public GridCoord(GridCoord obj)
 {
     X_coord = obj.X_coord;
     Y_coord = obj.Y_coord;
 }
示例#7
0
 public void AddGridMapReference(GridCoord p)
 {
     ++GridMapReference[p.x_coord][p.y_coord];
     SetUnloadReferenceLock(new GridCoord(63 - p.x_coord, 63 - p.y_coord), true);
 }