Ejemplo n.º 1
0
 private Direction FoodInDirection(VoxelInfo[, ,] neighbourhood)
 {
     for (int t = 0; t < 3; ++t)
     {
         for (int h = 0; h < 3; ++h)
         {
             for (int b = 0; b < 3; ++b)
             {
                 if (!(t == 1 && h == 1 && b == 1))                             // if not the voxel itself
                 {
                     if (TypeInformation.IsBiomass(neighbourhood[t, h, b].Type))
                     {
                         return(DirectionConverter.ToDirection(t, h, b));
                     }
                 }
             }
         }
     }
     return(Direction.SELF);
 }
Ejemplo n.º 2
0
 private Direction GetBranchDirection(VoxelInfo[, ,] neighbourhood)
 {
     if (neighbourhood[2, 1, 1].Type == VoxelType.PINE_WOOD && neighbourhood[0, 1, 1].Type == VoxelType.EMPTY)
     {
         return(DirectionConverter.ToDirection(0, 1, 1));
     }
     if (neighbourhood[0, 1, 1].Type == VoxelType.PINE_WOOD && neighbourhood[2, 1, 1].Type == VoxelType.EMPTY)
     {
         return(DirectionConverter.ToDirection(2, 1, 1));
     }
     if (neighbourhood[1, 1, 2].Type == VoxelType.PINE_WOOD && neighbourhood[1, 1, 0].Type == VoxelType.EMPTY)
     {
         return(DirectionConverter.ToDirection(1, 1, 0));
     }
     if (neighbourhood[1, 1, 0].Type == VoxelType.PINE_WOOD && neighbourhood[1, 1, 2].Type == VoxelType.EMPTY)
     {
         return(DirectionConverter.ToDirection(1, 1, 2));
     }
     return(Direction.SELF);
 }