Ejemplo n.º 1
0
        private static void AddRoof(InsideCheck.GridPosition position, IRoof roof)
        {
            List <IRoof> list = InsideCheck.AffirmRoofList(position);

            list.Add(roof);
            InsideCheck.ForceRefresh(position);
        }
Ejemplo n.º 2
0
 public House(IDoor door, IWindow window, IRoof roof, IWall wall)
 {
     _door   = door;
     _window = window;
     _roof   = roof;
     _wall   = wall;
 }
Ejemplo n.º 3
0
 public static void RemoveRoof(IRoof roof)
 {
     if (InsideCheck._grid != null)
     {
         foreach (KeyValuePair <InsideCheck.GridPosition, InsideCheck.GridCell> keyValuePair in InsideCheck._grid)
         {
             InsideCheck.GridCell value = keyValuePair.Value;
             if (value.roofs != null)
             {
                 for (int i = value.roofs.Count - 1; i >= 0; i--)
                 {
                     if (value.roofs[i] == roof)
                     {
                         value.roofs.RemoveAt(i);
                     }
                 }
                 if (value.roofs.Count == 0)
                 {
                     value.roofs = null;
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        public static void AddRoof(IRoof roof)
        {
            List <Vector3> polygon = roof.GetPolygon();

            if (polygon.Count <= 0)
            {
                return;
            }
            Bounds bounds = new Bounds(polygon[0], Vector3.zero);

            for (int i = 1; i < polygon.Count; i++)
            {
                bounds.Encapsulate(polygon[i]);
            }
            InsideCheck.GridPosition gridPosition  = InsideCheck.ToGridPosition(bounds.min);
            InsideCheck.GridPosition gridPosition2 = InsideCheck.ToGridPosition(bounds.max);
            for (int j = gridPosition.x; j <= gridPosition2.x; j++)
            {
                for (int k = gridPosition.y; k <= gridPosition2.y; k++)
                {
                    InsideCheck.AddRoof(new InsideCheck.GridPosition(j, k), roof);
                }
            }
        }
Ejemplo n.º 5
0
 public void SetRoof(IRoof roof)
 {
     this.roof = roof;
 }
Ejemplo n.º 6
0
 private static bool IsRoofAbove(IRoof roof, Vector3 position)
 {
     return(roof.GetLevel() > position.y && MathEx.IsPointInPolygon(position, roof.GetPolygon()));
 }