public void Fire() { if (_fireRecoveryTime > 0) { return; } else { _fireRecoveryTime = FireRecovery; } MoveChess moveChess = new MoveChess(_moveChessTexture); //bullet.SetColor(new Color(0, 1, 0, 1)); moveChess.SetPosition(_sprite.GetPosition() + _gunOffset); //_moveChessManager.Shoot(moveChess); }
public void Restart() { POINT pt = new POINT(); Vector firstPosition = _sprite.GetPosition(); Vector nextPosition = _sprite.GetPosition(); firstPosition.X = _sprite.GetPosition().X - 228.5; firstPosition.Y = _sprite.GetPosition().Y - 256.5; moveChessR_KING.Dead = false; moveChessR_CAR1.Dead = false; moveChessR_CAR2.Dead = false; moveChessR_HORSE1.Dead = false; moveChessR_HORSE2.Dead = false; moveChessR_CANON1.Dead = false; moveChessR_CANON2.Dead = false; moveChessR_BISHOP1.Dead = false; moveChessR_BISHOP2.Dead = false; moveChessR_ELEPHANT1.Dead = false; moveChessR_ELEPHANT2.Dead = false; moveChessR_PAWN1.Dead = false; moveChessR_PAWN2.Dead = false; moveChessR_PAWN3.Dead = false; moveChessR_PAWN4.Dead = false; moveChessR_PAWN5.Dead = false; moveChessB_KING.Dead = false; moveChessB_CAR1.Dead = false; moveChessB_CAR2.Dead = false; moveChessB_HORSE1.Dead = false; moveChessB_HORSE2.Dead = false; moveChessB_CANON1.Dead = false; moveChessB_CANON2.Dead = false; moveChessB_BISHOP1.Dead = false; moveChessB_BISHOP2.Dead = false; moveChessB_ELEPHANT1.Dead = false; moveChessB_ELEPHANT2.Dead = false; moveChessB_PAWN1.Dead = false; moveChessB_PAWN2.Dead = false; moveChessB_PAWN3.Dead = false; moveChessB_PAWN4.Dead = false; moveChessB_PAWN5.Dead = false; bool isR_CAR1 = true; bool isR_HORSE1 = true; bool isR_CANON1 = true; bool isR_BISHOP1 = true; bool isR_ELEPHANT1 = true; bool isB_CAR1 = true; bool isB_HORSE1 = true; bool isB_CANON1 = true; bool isB_BISHOP1 = true; bool isB_ELEPHANT1 = true; int u = 1; int v = 1; // moveChess.SetPosition(firstPostion); for (int i = 0; i < 10; i++) { for (int j = 0; j < 9; j++) { if (Level.m_ChessBoard[i, j] == Form1.NOCHESS) { continue; } pt.x = j * 57; pt.y = i * 57; nextPosition.X = firstPosition.X + pt.x; nextPosition.Y = firstPosition.Y + pt.y; switch (Level.m_ChessBoard[i, j]) { case Form1.R_KING: moveChessR_KING.nChessID = Form1.R_KING; moveChessR_KING.ptMovePoint = pt; moveChessR_KING.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_KING); break; case Form1.R_CAR: if (isR_CAR1) { moveChessR_CAR1.nChessID = Form1.R_CAR; moveChessR_CAR1.ptMovePoint = pt; moveChessR_CAR1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_CAR1); isR_CAR1 = false; } else { moveChessR_CAR2.nChessID = Form1.R_CAR; moveChessR_CAR2.ptMovePoint = pt; moveChessR_CAR2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_CAR2); isR_CAR1 = true; } break; case Form1.R_HORSE: if (isR_HORSE1) { moveChessR_HORSE1.nChessID = Form1.R_HORSE; moveChessR_HORSE1.ptMovePoint = pt; moveChessR_HORSE1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_HORSE1); isR_HORSE1 = false; } else { moveChessR_HORSE2.nChessID = Form1.R_HORSE; moveChessR_HORSE2.ptMovePoint = pt; moveChessR_HORSE2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_HORSE2); isR_HORSE1 = true; } break; case Form1.R_CANON: if (isR_CANON1) { moveChessR_CANON1.nChessID = Form1.R_CANON; moveChessR_CANON1.ptMovePoint = pt; moveChessR_CANON1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_CANON1); isR_CANON1 = false; } else { moveChessR_CANON2.nChessID = Form1.R_CANON; moveChessR_CANON2.ptMovePoint = pt; moveChessR_CANON2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_CANON2); isR_CANON1 = true; } break; case Form1.R_BISHOP: if (isR_BISHOP1) { moveChessR_BISHOP1.nChessID = Form1.R_BISHOP; moveChessR_BISHOP1.ptMovePoint = pt; moveChessR_BISHOP1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_BISHOP1); isR_BISHOP1 = false; } else { moveChessR_BISHOP2.nChessID = Form1.R_BISHOP; moveChessR_BISHOP2.ptMovePoint = pt; moveChessR_BISHOP2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_BISHOP2); isR_BISHOP1 = true; } break; case Form1.R_ELEPHANT: if (isR_ELEPHANT1) { moveChessR_ELEPHANT1.nChessID = Form1.R_ELEPHANT; moveChessR_ELEPHANT1.ptMovePoint = pt; moveChessR_ELEPHANT1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_ELEPHANT1); isR_ELEPHANT1 = false; } else { moveChessR_ELEPHANT2.nChessID = Form1.R_ELEPHANT; moveChessR_ELEPHANT2.ptMovePoint = pt; moveChessR_ELEPHANT2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_ELEPHANT2); isR_ELEPHANT1 = true; } break; case Form1.R_PAWN: switch (u) { case 1: moveChessR_PAWN1.nChessID = Form1.R_PAWN; moveChessR_PAWN1.ptMovePoint = pt; moveChessR_PAWN1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_PAWN1); u++; break; case 2: moveChessR_PAWN2.nChessID = Form1.R_PAWN; moveChessR_PAWN2.ptMovePoint = pt; moveChessR_PAWN2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_PAWN2); u++; break; case 3: moveChessR_PAWN3.nChessID = Form1.R_PAWN; moveChessR_PAWN3.ptMovePoint = pt; moveChessR_PAWN3.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_PAWN3); u++; break; case 4: moveChessR_PAWN4.nChessID = Form1.R_PAWN; moveChessR_PAWN4.ptMovePoint = pt; moveChessR_PAWN4.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_PAWN4); u++; break; case 5: moveChessR_PAWN5.nChessID = Form1.R_PAWN; moveChessR_PAWN5.ptMovePoint = pt; moveChessR_PAWN5.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessR_PAWN5); u = 1; break; } break; case Form1.B_KING: moveChessB_KING.nChessID = Form1.B_KING; moveChessB_KING.ptMovePoint = pt; moveChessB_KING.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_KING); break; case Form1.B_CAR: if (isB_CAR1) { moveChessB_CAR1.nChessID = Form1.B_CAR; moveChessB_CAR1.ptMovePoint = pt; moveChessB_CAR1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_CAR1); isB_CAR1 = false; } else { moveChessB_CAR2.nChessID = Form1.B_CAR; moveChessB_CAR2.ptMovePoint = pt; moveChessB_CAR2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_CAR2); isB_CAR1 = true; } break; case Form1.B_HORSE: if (isB_HORSE1) { moveChessB_HORSE1.nChessID = Form1.B_HORSE; moveChessB_HORSE1.ptMovePoint = pt; moveChessB_HORSE1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_HORSE1); isB_HORSE1 = false; } else { moveChessB_HORSE2.nChessID = Form1.B_HORSE; moveChessB_HORSE2.ptMovePoint = pt; moveChessB_HORSE2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_HORSE2); isB_HORSE1 = true; } break; case Form1.B_CANON: if (isB_CANON1) { moveChessB_CANON1.nChessID = Form1.B_CANON; moveChessB_CANON1.ptMovePoint = pt; moveChessB_CANON1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_CANON1); isB_CANON1 = false; } else { moveChessB_CANON2.nChessID = Form1.B_CANON; moveChessB_CANON2.ptMovePoint = pt; moveChessB_CANON2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_CANON2); isB_CANON1 = true; } break; case Form1.B_BISHOP: if (isB_BISHOP1) { moveChessB_BISHOP1.nChessID = Form1.B_BISHOP; moveChessB_BISHOP1.ptMovePoint = pt; moveChessB_BISHOP1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_BISHOP1); isB_BISHOP1 = false; } else { moveChessB_BISHOP2.nChessID = Form1.B_BISHOP; moveChessB_BISHOP2.ptMovePoint = pt; moveChessB_BISHOP2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_BISHOP2); isB_BISHOP1 = true; } break; case Form1.B_ELEPHANT: if (isB_ELEPHANT1) { moveChessB_ELEPHANT1.nChessID = Form1.B_ELEPHANT; moveChessB_ELEPHANT1.ptMovePoint = pt; moveChessB_ELEPHANT1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_ELEPHANT1); isB_ELEPHANT1 = false; } else { moveChessB_ELEPHANT2.nChessID = Form1.B_ELEPHANT; moveChessB_ELEPHANT2.ptMovePoint = pt; moveChessB_ELEPHANT2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_ELEPHANT2); isB_ELEPHANT1 = true; } break; case Form1.B_PAWN: switch (v) { case 1: moveChessB_PAWN1.nChessID = Form1.B_PAWN; moveChessB_PAWN1.ptMovePoint = pt; moveChessB_PAWN1.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_PAWN1); v++; break; case 2: moveChessB_PAWN2.nChessID = Form1.B_PAWN; moveChessB_PAWN2.ptMovePoint = pt; moveChessB_PAWN2.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_PAWN2); v++; break; case 3: moveChessB_PAWN3.nChessID = Form1.B_PAWN; moveChessB_PAWN3.ptMovePoint = pt; moveChessB_PAWN3.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_PAWN3); v++; break; case 4: moveChessB_PAWN4.nChessID = Form1.B_PAWN; moveChessB_PAWN4.ptMovePoint = pt; moveChessB_PAWN4.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_PAWN4); v++; break; case 5: moveChessB_PAWN5.nChessID = Form1.B_PAWN; moveChessB_PAWN5.ptMovePoint = pt; moveChessB_PAWN5.SetPosition(nextPosition); _moveChessManager.InitializeChessman(moveChessB_PAWN5); v = 1; break; } break; } //m_Chessman.Draw(&MemDC, m_ChessBoard[i][j] - 1, pt, ILD_TRANSPARENT); } } //MoveChess moveChess = new MoveChess(_moveChessTexture); //bullet.SetColor(new Color(0, 1, 0, 1)); //Vector firstPostion = _sprite.GetPosition(); //firstPostion.X = _sprite.GetPosition().X - 228.5; //firstPostion.Y = _sprite.GetPosition().Y - 256.5; //moveChess.SetPosition(firstPostion); //_moveChessManager.InitializeChessman(moveChess); }