// 尝试移动棋子 public GameBoard tryChessMove(Vector3i position, int direction) { // 当前格指向方向的信息判断 GameChess gc = _Board.getGameChessRef(position); //如果这个棋子上有向前走的技能,则可以走 if (gc.hasSuchKindSkill(EffectType.move)) { _TempBoard = _Board.getCopy(); if (_TempBoard.moveChess(position)) { Rule.updateBoard(_TempBoard); return(_TempBoard); } else { Debug.Log("严重错误"); } } //如果不能移动,返回一个null return(null); }
public bool moveChess(Vector3i position) { GameChess gc = getGameChessRef(position); //如果有这个棋子并且有移动技能 if (gc != null && gc.hasSuchKindSkill(EffectType.move)) { //移动并且告诉Judgement去掉其他移动技能 //先把这个棋子从原来GameChessList那里抹杀掉 _GameChessList.Remove(gc); //然后从ChessBoard层面也抹杀掉 _ChessBoard.removeChess(gc.getPosition()); //然后加入新棋子 Skill sk = gc.findSkill(EffectType.move); Chess nc = _ChessBoard.placeChess(new Chess(gc.getPlayerID(), gc.getDirection(), sk.getEffectPosition())); _GameChessList.Add(new GameChess(nc)); Vector3i pos = getPointedPosition(position, gc.getDirection()); Rule.removeNewSkill(EffectType.move, pos, this); return(true); } return(false); }