Exemple #1
0
    public void FindAllPossibleMoves(List <List <Action> > actions, GameObject[,] grid, Square[,] gameBoard, Material material1, Material material2, Material material4)
    {
        possibleMoves = new MovingControl();

        List <List <Action> > moves = new List <List <Action> >();
        List <int>            li    = new List <int>();

        for (int i = 0; i < actions.Count; i++)
        {
            for (int j = 0; j < actions[i].Count; j++)
            {
                if (actions[i][j].Src.R == row && actions[i][j].Src.C == col)
                {
                    li.Add(i);
                }
            }
        }
        for (int i = 0; i < actions.Count; i++)
        {
            foreach (int j in li)
            {
                if (j == i)
                {
                    moves.Add(actions[i]);
                }
            }
        }
        foreach (List <Action> a in moves)
        {
            possibleMoves.AddPossiblePath(fillPath(a, gameBoard));
        }
        foreach (Square square in possibleMoves.GetAllFinalTargets())
        {
            square.HighLightMove(material4);
        }
        foreach (List <Square> list in possibleMoves.GetAllPathsEmpty())
        {
            foreach (Square square1 in list)
            {
                if (grid[square1.row, square1.col] != null)
                {
                    square1.HighLightMove(material2);
                }
                else
                {
                    square1.HighLightMove(material1);
                }
            }
        }
    }
Exemple #2
0
    public void UnHighLightSquares()
    {
        foreach (List <Square> list in possibleMoves.GetAllPathsEmpty())
        {
            foreach (Square square in list)
            {
                square.UnHighLightSquare();
            }
        }

        foreach (Square square1 in possibleMoves.GetAllFinalTargets())
        {
            square1.UnHighLightSquare();
        }
    }