Exemplo n.º 1
0
        protected override void InitGrid()
        {
            VectorPoint rectDimensions = Dimensions;

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

                break;

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

                break;

            case Shape.FatRectangle:
                base.Grid = DiamondGrid <TileCell> .FatRectangle(rectDimensions.X, rectDimensions.Y);

                break;

            case Shape.ThinRectangle:
                base.Grid = DiamondGrid <TileCell> .ThinRectangle(rectDimensions.X, rectDimensions.Y);

                break;

            case Shape.Diamond:
                base.Grid = DiamondGrid <TileCell> .Diamond(Size);

                break;

            case Shape.Single:
                base.Grid = DiamondGrid <TileCell> .Single();

                break;

            case Shape.Custom:
                var shapeBuilder = GetComponent <CustomGridBuilder>();
                base.Grid = shapeBuilder.MakeGrid <TileCell, DiamondPoint>();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

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

            case RectNeighborType.Diagonals:
                ((DiamondGrid <TileCell>)base.Grid).SetNeighborsDiagonals();
                break;

            case RectNeighborType.MainAndDiagonals:
                ((DiamondGrid <TileCell>)base.Grid).SetNeighborsMainAndDiagonals();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }