Exemplo n.º 1
0
        private void InitializeCellOffset(CellOffsetDirectionEnum vectorDirection, int vectorModule)
        {
            switch (vectorDirection)
            {
            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_Forward:
                this.HorizontalOffset = 0;
                this.VerticalOffset   = vectorModule;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_DiagonalForwardRight:
                this.HorizontalOffset = vectorModule;
                this.VerticalOffset   = vectorModule;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_Right:
                this.HorizontalOffset = 0;
                this.VerticalOffset   = vectorModule;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_DiagonalBackwardRight:
                this.HorizontalOffset = vectorModule;
                this.VerticalOffset   = -vectorModule;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_Back:
                this.HorizontalOffset = -vectorModule;
                this.VerticalOffset   = 0;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_DiagonalBackwardLeft:
                this.HorizontalOffset = -vectorModule;
                this.VerticalOffset   = -vectorModule;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_Left:
                this.HorizontalOffset = -vectorModule;
                this.VerticalOffset   = 0;
                break;

            case CellOffsetDirectionEnum.CellOffsetDirectionEnum_DiagonalForwardLeft:
                this.HorizontalOffset = -vectorModule;
                this.VerticalOffset   = vectorModule;
                break;

            default:
                this.HorizontalOffset = 0;
                this.VerticalOffset   = 0;
                break;
            }
        }
Exemplo n.º 2
0
 public ChessCellOffset(CellOffsetDirectionEnum vectorDirection, int vectorModule)
 {
     this.HorizontalOffset = 0;
     this.VerticalOffset   = 0;
     InitializeCellOffset(vectorDirection, vectorModule);
 }