Exemple #1
0
    /// <summary>
    /// Invoked after chess piece was placed on board
    /// </summary>
    /// <param name="figure">Chess piece controller</param>
    /// <param name="figureRange">Chess piece range</param>
    public void OnFigureEnteredOnBoard(FigureController figure, int figureRange)
    {
        BoardPointController        figurePoint = boardPointControllers.Find(x => x.GetTransform().position == figure.transform.position);
        List <BoardPointController> pointsInRange;
        List <BoardPointController> pointsInRangeInPath;

        (pointsInRange, pointsInRangeInPath) = GetPointsInRange(figure.transform.position, figureRange);
        figure.SetPointsForShoting(pointsInRange, pointsInRangeInPath);
    }
Exemple #2
0
    /// <summary>
    /// Invoked after clicking on board
    /// </summary>
    /// <param name="objectName"></param>
    public void OnClickDetected(string objectName)
    {
        BoardPointController point = boardPointControllers.Find(x => x.name == objectName);

        if (point != null && point.BoardPointType != BoardPointType.Occupied && point.BoardPointType != BoardPointType.Path)
        {
            figuresManager.OnPointOnBoardClicked(point.transform.position, point, OnPointStartOccupied);
        }
    }
    /// <summary>
    /// Moves chess piece to given tile
    /// </summary>
    /// <param name="endPosition">End of moving position</param>
    /// <param name="point">Tile on map</param>
    /// <param name="onSuccesFigureMoving">Callback to succesful figure movement</param>
    public void OnPointOnBoardClicked(Vector3 endPosition, BoardPointController point, Action <BoardPointController> onSuccesFigureMoving)
    {
        if (figureToPlace != null)
        {
            if (figureToPlace.CanMoveFigure() && pointValuesController.RemovePoints(figureToPlace.FigureCost))
            {
                figureToPlace.StartMoveFigure(endPosition, OnFigureOnBoard, curve);
                onSuccesFigureMoving(point);
            }

            figureToPlace = null;
        }
    }
Exemple #4
0
    /// <summary>
    /// Gets path on board
    /// </summary>
    /// <returns></returns>
    public List <PathElement> GetPath()
    {
        List <PathElement> path = new List <PathElement>();

        foreach (string pathElement in pathConfig.path)
        {
            BoardPointController controller = boardPointControllers.Find(x => x.name.Contains(pathElement));
            controller.ChangeState(BoardPointType.Path);
            controller.SetVisible(true);
            path.Add(controller);
        }

        return(path);
    }
Exemple #5
0
 /// <summary>
 /// Invoked after tile becoms occupied
 /// </summary>
 /// <param name="point">Tile on board</param>
 public void OnPointStartOccupied(BoardPointController point)
 {
     point.ChangeState(BoardPointType.Occupied);
 }