public void PieceAction(Vector2 startV, Vector2 endV, int action, bool player) { int x1 = (int)startV.x; int y1 = (int)startV.y; int x2 = (int)endV.x; int y2 = (int)endV.y; Piece selectPiece = boardPiece[x1, y1]; if (action == 0) { if (player == GameManager.Instance.player) { int decreaseMoveMana = selectPiece.MoveManaCheck(new Vector2(x1, y1), new Vector2(x2, y2)); GameManager.Instance.NetManaCrease(decreaseMoveMana); GameManager.Instance.MovePiece(selectPiece, x2, y2); StartCoroutine(selectPiece.ActionAnim(1)); } boardPiece[x2, y2] = selectPiece; boardPiece[x1, y1] = null; selectPiece.CurrentX = x2; selectPiece.CurrentZ = y2; selectPiece.move = false; } else if (action == 1) { selectPiece.SetTargetPosition(x2, y2); if (player == GameManager.Instance.player) { int decreaseAttackMana = -selectPiece.attackMana; GameManager.Instance.NetManaCrease(decreaseAttackMana); StartCoroutine(selectPiece.ActionAnim(2)); } selectPiece.action = false; } else if (action == 2) { selectPiece.SetTargetPosition(x2, y2); if (player == GameManager.Instance.player) { int decreaseSkillMana = -selectPiece.skillMana; GameManager.Instance.NetManaCrease(decreaseSkillMana); StartCoroutine(selectPiece.ActionAnim(3)); } selectPiece.pieceMP = 0; selectPiece.action = false; } }