示例#1
0
 public void MoveTo(Crow.Point newPos, bool animate = false)
 {
     BoardCell = newPos;
     if (animate)
     {
         Animation.StartAnimation(new PathAnimation(this, "Position",
                                                    new BezierPath(
                                                        Position,
                                                        new Vector3(newPos.X, newPos.Y, 0f), Vector3.UnitZ), VkChess.animationSteps),
                                  0);
     }             //else
                   //	Position = new Vector3 (newPos.X, newPos.Y, 0f);
 }
示例#2
0
        public Piece(ChessColor player, PieceType type, int col, int line)
        {
            this.instanceIdx = nextInstanceIdx++;
            this.Type        = type;
            this.Player      = player;
            initX            = col;
            initY            = line;
            position.X       = initX;
            position.Y       = initY;
            BoardCell        = new Crow.Point(col, line);

            instData = new VkChess.InstanceData(Player == ChessColor.White ? whiteColor : blackColor, Matrix4x4.Identity);

            if (player == ChessColor.Black && type == PieceType.Knight)
            {
                zAngle = MathHelper.Pi;
            }

            updatePos();
        }
示例#3
0
 public void Reset(bool animate = true)
 {
     xAngle = 0f;
     Z      = 0f;
     if (HasMoved)
     {
         if (animate)
         {
             Animation.StartAnimation(new PathAnimation(this, "Position",
                                                        new BezierPath(
                                                            Position,
                                                            new Vector3(initX, initY, 0f), Vector3.UnitZ)));
         }
         //else
         //    Position = new Vector3(initX, initY, 0f);
     }
     if (IsPromoted)
     {
         Unpromote();
     }
     IsPromoted = false;
     HasMoved   = false;
     BoardCell  = new Crow.Point(initX, initY);
 }