Пример #1
0
 void CreateWalls(Body root, WallSettings[,] array, int width, int height, int weight, string prefix, Func<int, int, Point> cooMaker)
 {
     for (int x = 0; x < array.GetLength(0); x++)
         for (int y = 0; y < array.GetLength(1); y++)
         {
             var wall = array[x, y];
             if (wall == WallSettings.NoWall) continue;
             Color color = Color.LightGray;
             string name = prefix;
             switch (wall)
             {
                 case WallSettings.RedSocket: name += "R"; color = Color.DarkRed; break;
                 case WallSettings.BlueSocket: name += "B"; color = Color.DarkBlue; break;
                 case WallSettings.GreenSocket: name += "G"; color = Color.DarkGreen; break;
             }
             var coo = cooMaker(x, y);
             root.Add(new Box
             {
                 XSize = width,
                 YSize = height,
                 ZSize = weight,
                 Location = new Frame3D(coo.X, coo.Y, 0),
                 DefaultColor = color,
                 Type = name,
                 IsMaterial = true,
                 IsStatic = true,
             });
         }
 }
Пример #2
0
 Color WallColor(WallSettings wall)
 {
     switch (wall)
     {
         case WallSettings.Wall: return Color.DarkGray;
         case WallSettings.RedSocket: return Color.DarkRed;
         case WallSettings.GreenSocket: return Color.DarkGreen;
         case WallSettings.BlueSocket: return Color.DarkBlue;
     }
     throw new ArgumentException();
 }
Пример #3
0
 private static WallSettings GetWallSettings(WallSettings wall)
 {
     if (wall == WallSettings.RedSocket)
     {
         return(WallSettings.BlueSocket);
     }
     if (wall == WallSettings.BlueSocket)
     {
         return(WallSettings.RedSocket);
     }
     return(wall);
 }
Пример #4
0
 private static WallSettings GetWallSettings(WallSettings wall)
 {
     if (wall == WallSettings.RedSocket)
         return WallSettings.BlueSocket;
     if (wall == WallSettings.BlueSocket)
         return WallSettings.RedSocket;
     return wall;
 }