예제 #1
0
        protected override void InitGrid()
        {
            VectorPoint rectDimensions = Dimensions;

            switch (shape)
            {
            case Shape.Rectangle:
                base.Grid = RectGrid <MeshCell> .Rectangle(rectDimensions.X, rectDimensions.Y);

                break;

            case Shape.Parallelogram:
                base.Grid = RectGrid <MeshCell> .Parallelogram(rectDimensions.X, rectDimensions.Y);

                break;

            case Shape.CheckerBoard:
                base.Grid = RectGrid <MeshCell> .CheckerBoard(rectDimensions.X, rectDimensions.Y);

                break;

            case Shape.Circle:
                base.Grid = RectGrid <MeshCell> .BeginShape().Circle(size).EndShape();

                break;

            case Shape.Custom:
                base.Grid = GetCustomGrid();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            switch (neighborSetup)
            {
            case RectNeighborType.Main:
                ((RectGrid <MeshCell>)base.Grid).SetNeighborsMain();
                break;

            case RectNeighborType.Diagonals:
                ((RectGrid <MeshCell>)base.Grid).SetNeighborsDiagonals();
                break;

            case RectNeighborType.MainAndDiagonals:
                ((RectGrid <MeshCell>)base.Grid).SetNeighborsMainAndDiagonals();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #2
0
파일: Op.cs 프로젝트: mhaque3/soa_unity
 /**
  *      Starts a compound shape operation.
  *
  *      Any shape that is defined in terms of other shape operations must use this method, and use Endgroup() to end the definition.
  *
  *              public static RectShapeInfo<TCell> MyCustomShape(this RectOp<TCell> op)
  *              {
  *                      return
  *                              BeginGroup()
  *                                      .Shape1()
  *                                      .Union()
  *                                      .Shape2()
  *                              .EndGroup(op);
  *              }
  *
  *      @since 1.1
  */
 public RectOp <TCell> BeginGroup()
 {
     return(RectGrid <TCell> .BeginShape());
 }