Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using TheChess;
- using TheChess.Mechanism;
- using UnityEngine;
- public class AIGUI : ChessGameAIGUI
- {
- public static Action<ChessPiece.ChessPieceType,string,bool> OnPeaceMoved;
- protected override void OnPieceFinishMoving(ChessMove _move, ChessPieceObject _selectedTarget, bool _isMoveContinueGame)
- {
- base.OnPieceFinishMoving(_move, _selectedTarget, _isMoveContinueGame);
- ReportMove(_move,_selectedTarget);
- }
- protected override void OnPieceFinishAttacking(ChessMove _move, ChessPieceObject _selectedTarget, ChessPieceObject _capturedTarget, bool _isMoveContinueGame)
- {
- base.OnPieceFinishAttacking(_move, _selectedTarget, _capturedTarget, _isMoveContinueGame);
- ReportMove(_move,_selectedTarget);
- }
- private void ReportMove(ChessMove _move, ChessPieceObject _selectedTarget)
- {
- string _moveDescription = _move.End.Description;
- bool _isWhite = _selectedTarget.Piece.Color.IsWhite;
- OnPeaceMoved?.Invoke(_selectedTarget.Piece.PieceType,_moveDescription,_isWhite);
- }
- protected override ChessMove.ChessMoveType OpponentExecuteMoveLogic(ChessMove _move, ChessPiece.ChessPieceType _promotionType)
- {
- var _moveType = Game.ExecuteWithoutClearingUndoHistories(_move, _promotionType);
- return _moveType;
- }
- protected override void AIMakeMove(ChessMove _move, ChessPiece.ChessPieceType _promotionType)
- {
- InstantMove(_move, _promotionType, false);
- ChangeTileColor(_move, Color.cyan);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement