Пример #1
0
 void Awake()
 {
     movableComponent    = GetComponent <MovablePiece>();
     colorComponent      = GetComponent <ColorPiece>();
     selectableComponent = GetComponent <SelectablePiece>();
     clearableComponent  = GetComponent <ClearablePiece>();
 }
Пример #2
0
        public static Piece Create(string type, ColorPiece color, Coordinate coor)
        {
            if (type == ChessResources.Rook)
            {
                return(new Rook(color, coor));
            }

            else if (type == ChessResources.Knight)
            {
                return(new Knight(color, coor));
            }

            else if (type == ChessResources.Bishop)
            {
                return(new Bishop(color, coor));
            }

            else if (type == ChessResources.Queen)
            {
                return(new Queen(color, coor));
            }

            if (type == ChessResources.King)
            {
                return(new King(color, coor));
            }

            else if (type == ChessResources.Pawn)
            {
                return(new Pawn(color, coor));
            }

            return(null);
        }
Пример #3
0
    public ColorPiece FindMatch(int col, int ii, int ii2, int[] rpos, int[] rlen, bool[] reverse)
    {
        IntPtr     cPtr = HCSMVOPINVOKE.ColorPieceList_FindMatch(swigCPtr, col, ii, ii2, rpos, rlen, reverse);
        ColorPiece ret  = (cPtr == IntPtr.Zero) ? null : new ColorPiece(cPtr, false);

        return(ret);
    }
Пример #4
0
 public void StartNewGame() //JS: btnNewGame click
 {
     Session["chessboard"]  = new Chessboard();
     actualPosibleMovements = null;
     colorWhoMove           = ColorPiece.White;
     actualPieceSelected    = null;
     this.Index();
 }
Пример #5
0
 void Awake()
 {
     movableComponent    = GetComponent <MovablePiece> ();
     colorComponent      = GetComponent <ColorPiece> ();
     clearableComponent  = GetComponent <ClearablePiece> ();
     generativeComponent = GetComponent <GenerativePiece>();
     scaleableComponent  = GetComponent <ScaleablePiece>();
 }
Пример #6
0
        public static ColorPiece ToogleColor(this ColorPiece colorPiece)
        {
            if (colorPiece == ColorPiece.Black)
            {
                colorPiece = ColorPiece.White;
            }
            else
            {
                colorPiece = ColorPiece.Black;
            }

            return(colorPiece);
        }
Пример #7
0
        public JsonResult Move(int x, int y) //JS: move
        {
            Movement actual = this.actualPosibleMovements.Where(w => w.TentativeCoordinate.CompareTo(x, y)).FirstOrDefault();

            if (actual == null)
            {
                throw new HttpRequestValidationException("No se encontro el movimiento seleccionado");
            }

            bool       fin = this.chessboard.Move(actual);
            JsonResult result;

            this.chessboard.colorMoved = colorWhoMove.ToString().ToUpper();     //Color que movio
            colorWhoMove = colorWhoMove.ToogleColor();
            this.chessboard.colorWhoDoMove = colorWhoMove.ToString().ToUpper(); //color que le toca mover
            result = Json(new { colorMoved = actual.piece.color, color = colorWhoMove, resultado = fin });
            return(result);
        }
Пример #8
0
 private void Awake()
 {
     //若有移动脚本说明可以移动
     moveableComponent = this.GetComponent <MoveablePiece>();
     if (moveableComponent != null)
     {
         isMoveable = true;
     }
     //有颜色组件说明可以变换颜色
     colorComponent = this.GetComponent <ColorPiece>();
     if (colorComponent != null)
     {
         isColor = true;
     }
     //有消除组件说明可以消除
     clearComponent = GetComponent <ClearablePiece>();
     if (clearComponent != null)
     {
         isClear = true;
     }
 }
Пример #9
0
 public Knight(ColorPiece paramColor, Coordinate initialCoordinate) : base(paramColor, initialCoordinate)
 {
 }
Пример #10
0
 void Awake()
 {
     movableComponent   = GetComponent <Movablepiece>();//通过查看该属性是否为空来判断当前物体是否能移动
     colorComponent     = GetComponent <ColorPiece>();
     clearableComponent = GetComponent <ClearablePiece>();
 }
Пример #11
0
 public Piece(ColorPiece paramColor, Coordinate initialCoordinate)
 {
     this._color     = paramColor;
     this.coordinate = initialCoordinate;
 }
Пример #12
0
 public Rook(ColorPiece paramColor, Coordinate initialCoordinate) :
     base(paramColor, initialCoordinate)
 {
 }
Пример #13
0
 void Awake()
 {
     movableComponent = GetComponent <MovablePiece> ();
     colorComponent   = GetComponent <ColorPiece> ();
 }
Пример #14
0
 public Bishop(ColorPiece paramColor, Coordinate initialCoordinate) :
     base(paramColor, initialCoordinate)
 {
 }
Пример #15
0
 private void Awake()
 {
     movableComponent    = GetComponent <movablepiece>();
     colorPieceComponent = GetComponent <ColorPiece>();
     clearableComponent  = GetComponent <Clearablepiece>();
 }
Пример #16
0
 private void Awake()
 {
     movableComponent   = this.GetComponent <MovablePiece>();
     colorComponent     = this.GetComponent <ColorPiece>();
     clearableComponent = GetComponent <ClearablePiece>();
 }
Пример #17
0
 void Awake()
 {
     movable   = GetComponent <MovablePiece>();
     color     = GetComponent <ColorPiece>();
     clearable = GetComponent <ClearablePiece>();
 }
Пример #18
0
 public static HandleRef getCPtr(ColorPiece obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }